how to get width of screen and add some value to it in css

Viewed 121

I want to get the screen size and add 253px to it
Or something like this in css

width: (100% + 253px)

how can I make this happen?

3 Answers

tnx to my freind Alenx

.container { min-height: calc("~100vh - 150px"); } 

You can set width and height relative to the viewport. with vh, vw

There you can add an offset in px with the following line of code.

.container { min-height: calc("~100vh - 150px"); } 

For the CSS to measure a percent of the window screen and add to or cut from that amount in a pixel scale, you'll need to hit ElementSelector { width: calc(100% - 253px) } in your CSS (without "calc" function, that math calculation can't be computed since they're of different scales).

Related