Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Do you still use

#74983
jamygolden
Member

@fjorko are you asking StephBertha or me?

I’ll explain both:

The <noscript>:

Wrap anything within <noscript /> and it will only load if javascript has not loaded. For example:
<noscript>Please turn on javascript!</noscript>

<html class=”no-js”> & Modernizr:

Modernizr is very useful. Very basically, it provides feature detection along with some other cool features, such as HTML5 tag support for older browsers.

Very simply, Modernizr checks to see if <html> has a class of “no-js”. If so, it removes it. This way, you could do something like:

.no-js #slider{display: none;}

and have the CSS hide a javascript slider or maybe something like

.no-js #slider li{display: none;}
.no-js #slider li:first-child{display: block;}

That would hide all slides except the first.

Those are just very small examples of how you could use the no-js class.