O my gosh just exploded my brain

By default I always add this bit to my sites…

<script type="text/javascript">document.documentElement.className = 'js-on';</script>

This adds class js-on to the html tag before page load if JS is on. So when I start working on coding for JS Off I can just overwrite the rules and etc.

Trivial for some I imagine, but I just got done tweaking a new site for mobile. 1/4 of it I did for js-on and 1/4 for js-off and the other 1/4 for js-on/js-off when desktop size and the other 1/4 for js-on/js-off for mobile size and everything in between. Man I had to blow out some cobwebs on that one. I’ve always considered using !important as a personal coding lazy/failure on my part. I had to use it once or twice. But I did it obsessively perfect and very happy with the site. Now I enter back into my cage of nothing to do depression until I think of a new project.

you can get rid of that bit if you want in html5 :slight_smile:

1 Like

Good to know thanks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.