I just came to know that we can find out the screen resolution of our users using screen.width and screen.height etc. But is there any way to have a variable body width. I mean can i set the body width property using jquery or javascript. This is gonna change with the resolution of every user so that my site seems perfect in all of them...
Can anyone help me in having code to set the width(CSS) of my page according to the value obtained through Jscript above.
Thanks
You can set the body with JavaScript...
document.body.style.width = '700px';
...or if you are using jQuery...
$('body').css('width', '700px');
You can use jquery and do it through .css
$('body').css('width', '1000px');
css()
documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With