Home > Blockchain >  Change the height of my element dynamically based on current window aspect ratio
Change the height of my element dynamically based on current window aspect ratio

Time:11-25

I want to add a bottom: value to my div where the value will vary be based on the browser window aspect ratio.

Is there a way to get the current aspect ratio width /height of my browser window in CSS?

.loading-animation{
bottom: ?
}

CodePudding user response:

You should use vh, vw viewport-height and viewport-width respectively. The content will adjust itself depending on the screen.

CodePudding user response:

You can use the aspect-radio property in CSS.

That property auto size the elements in reference about you screen size.

  • Related