css - Should I bother adding a class on a <main> tag? -
should bother adding class on <main> tag?
i try avoid poor selector intent header {} avoid risk of applying specific styling wide number of elements in project, according mdn:
there must not more 1
<main>element in document
so wonder, if use simple selector main {}, still considered bad practice?
well, while understand premise, answer yes without doubt. use lot, , develop custom wp sites , templates, add classes main element in order have stylesheet, can target main element different templates same stylesheet or re-using declarations minimal changes. example: main element on index page differ main element's content on inner pages, archives, search pages, etc, specially on highly customized sites
of course, if that's not case, there's no need , it's better leave without class, goes in taste. tend build themes classes, no matter if unused. way, if client or user needs use element @ later time, easier it.
needless say, semantic point of view:
<main class="index"> <main class="page"> <main class="archive"> <main class="blog"> looks lot better <main>
all being said, depends on , workflow, it's not set in stone, many html5 , w3c recommendations
Comments
Post a Comment