Help converting JS to CSS

I'm creating a website using a builder (Divi). I just need a bit of CSS code to scale and position one element (a video), but the only code I know is JS. I was wondering if anyone can help me translate it into CSS. Here's the JS code:

var browserW = window.innerWidth;
var browserH = window.innerHeight;

var aspect = browserW/browserH;
if (aspect > 1 && aspect < 2) {
vidW = browserH*2;
} else {
vidW = linear(aspect, 1, 2, (browserW*2), browserW);
vidSca = vidW/1920*100;
if (aspect > 2) {

Positioning a popup

Hi, I am not a dev but I need to position a popup. I found what I need here: I need the to position my popup as in the last link under section "position: absolute"...

div.relative {
position: relative;
width: 400px;
height: 200px;
border: 3px solid #73AD21;

div.absolute {
position: absolute;
top: 80px;
right: 0;
width: 200px;
height: 100px;
border: 3px solid #73AD21;

Slider/Carousel where image is sliced into sections

I am not new to CSS, but I have not been able to find anything about this on Google so I thought maybe I was using the wrong terminology.

I am looking to teach myself how to make a slider/carousel where the image is sliced into pieces and each slice is shifted off independently, revealing the image below as they "fly" off the screen.

I don't know how to describe this so Google will help me find the technology behind it.

Maybe it is actually done in Javascript more than CSS... I don't know.

How to repeat text/numbers from one page to another?


I'm new to CSS and development in general and I was wondering if anyone knew; how to display a figure i.e. £1,000,000 on one page and then have it display on another page automatically, instead of me having to manually update the figures on all the pages that figure is displayed on.

I was originally thinking php or javascript but I think this might be able to be done in CSS?

Change an image file on button-click

Hi, Complete newbie with JS.

Looking for ideas on JavaScript code to change an image on button-click.

My website is "under construction", the image changes are to show it is a "working" holding page.
Hopefully to keep visitors' interest.
(The library of images will be changed fairly often while the site is built).

Several images available, all with same name plus a number ...
eg: ppImg1, ppImg2, ... ppImg9, ppImg10, etc.

Basic idea is to have a counter set to zero the first time the page is brought up.

Syndicate content