css - What is so great about having 5 selectors to format a specific html tag? -


why people make complicated , not create id below selector parade

body > header > h1, span.title, .header-title {    /* set background-image here */ } 

just like

#myheadertitle {        /* set background-image here */ } 

what great having 5 selectors format specific html tag? why not use id directly?

i can agree times nested selectors may overused, if assign id elements want select not wery flexible.

my rule of tumb: if want apply style 1 spesific element, , not elements use uniform selector. ok use id

if want apply rule multiple elements similar nested selector "fingerprint" select nested selector use yous enogh nested selectors shure want hit undisired elements.

eks: logo image on top of page might use id. anchors inside menu this:

<div class="menu"> <ul> <li> <a href="http://example.com">link</a> </li> </ul> </div> 

i use ".menu ul li a"


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -