html - Use: Need Javascript code that gets the inner width/height of screen onload into width/height style variables -


i find innerwidth , innerheight of screen via javascript, , place values width , height variables of body class in style area (css) of html. example:

<style>   body { background-image: url("images/hello.jpg");           background-repeat: no-repeat; background-color: brown;           width: valuew; height: valueh;} </style> 

where valuew returned value of pixels of innerwidth of screen, , valueh innerheight. "px" pixels value need follow returned number of course.

is possible?

thanks input.

you're looking css vh , vw units, automatically.
no javascript needed.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -