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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -