mhulse / css-issues

Practical CSS code snippets and examples.
11 stars 1 forks source link

Hide/show with .no-js/.js classes #195

Open mhulse opened 5 years ago

mhulse commented 5 years ago
.js .hide-if-js {
    display: none;
}
.no-js .show-if-js {
    display: none;
}
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>

    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">

    <script>/*! no-js uglified | https://gist.github.com/mhulse/4704893 */!function(e){e.documentElement.className=e.documentElement.className.replace(/\bno-js\b/,"js")}(document);</script>

https://gist.github.com/mhulse/4704893