Re:My Current HTML Boilerplate
by faitswulff on Tuesday April 27, 2021 @12:15PM
(#26957950)
Hmm, why bother even having the no-js class, then?
[ Parent
| on HN ]
Re:My Current HTML Boilerplate
by Cederfjard on Tuesday April 27, 2021 @12:58PM
(#26958544)
Because you can target it with CSS and apply styles specific for when the document is viewed without JavaScript enabled.
Re:My Current HTML Boilerplate
by faitswulff on Tuesday April 27, 2021 @01:44PM
(#26959092)
Is it too much trouble to just override the base style with the js style? As in, don’t specify the base style with “no-js” at all, just the js overrides.
Re:My Current HTML Boilerplate
by mikepurvis on Tuesday April 27, 2021 @02:39PM
(#26959771)
Complicates the base case if you need to undo in it any unwanted styled applied in the no-js case.
Conceptually it's a lot easier to manage if they're fully distinct, or at least if the common bits are explicitly common.
most websites are going to be JS-first. If it makes sense for you to augment your site with JS, then sure knock yourself out and reverse it.
Re:My Current HTML Boilerplate
by contradistinct on Tuesday April 27, 2021 @12:59PM
(#26958559)
If javascript isn't running in the browser, the script won't run and the class won't change from no-js to js.