html - CSS change font style after declaring it, relation with before selector -


i've span elements make usage of before pseudo selector. works fine. problem content of :before need have different font style e.g no text-decoration etc. can not overwrite after declaring on span elements.

#myelement span {   text-decoration: underline; }  #myelement span + span:before {   content: "|";   text-decoration: none; } 

http://jsfiddle.net/dyjxw/

the text-decoration property not inherited, behaves in manner looks “forced inheritance”: “when specified on or propagated inline element, affects boxes generated element”. if :before pseudo-element has no text-decoration or has text-decoration: none set on it, generated content affected text-decoration of parent (the real span element).

however, specification adds: “note text decorations not propagated floating , absolutely positioned descendants, nor contents of atomic inline-level descendants such inline blocks , inline tables.” rid of underline generated content changing second rule this:

#myelement span + span:before {   content: "|";   display: inline-block; } 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -