Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Body styling for a noscript tag?

If no JavaScript is enabled, I want my body to have overflow:hidden (no scrollbars).

How can I solve this? Is it possible to use a noscript tag inside of <head> and set specific styles inside of it?

like image 757
matt Avatar asked Apr 29 '26 11:04

matt


1 Answers

If you mean the <body> of the HTML document, I'd build the HTML as it should be for the users with JS disabled. For example in the CSS file have body { overflow:hidden } and then use JavaScript to set the page as it should be for users with JavaScript enabled (i.e. remove the overflow:hidden with JavaScript).

like image 87
JJJ Avatar answered May 01 '26 01:05

JJJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!