fortnox007 Posted December 5, 2010 Share Posted December 5, 2010 Hi all, i do some css, but for some reason i missed a vital part of it and maybe someone might want to help me reset my brains a bit. What i really can't see yet is what should be the order of the selectors in css. for instance i see a.fancy span{ bla: bla bla; } but somewhere else i see .fancy a span{ bla: bla bla; } and than .fancy, a, span{ bla:bla bla; } Is there maybe someone who can explain how to never do this wrong again. For some reason it's really confusing for me. So the question is really which selector goes first and when to use a comma when not :'( Link to comment https://forums.phpfreaks.com/topic/220765-i-entered-an-infinited-loop-of-confusion-selectors-order/ Share on other sites More sharing options...
fortnox007 Posted December 5, 2010 Author Share Posted December 5, 2010 Okay let me rephrase it, what is the real difference between p.centre {} and .center p {} The rest I just found out. Link to comment https://forums.phpfreaks.com/topic/220765-i-entered-an-infinited-loop-of-confusion-selectors-order/#findComment-1143417 Share on other sites More sharing options...
haku Posted December 6, 2010 Share Posted December 6, 2010 .fancy a span This targets a span element inside an anchor tag that is inside any elements that have a class of 'fancy' .fancy, a, span This targets all elements with a class of 'fancy', all anchor tags, and all span elements. p.centre This targets all paragraph tags that have a class of 'centre'. .center p This targets all paragraph tags that are inside any elements that have a class of 'centre' Link to comment https://forums.phpfreaks.com/topic/220765-i-entered-an-infinited-loop-of-confusion-selectors-order/#findComment-1143462 Share on other sites More sharing options...
fortnox007 Posted December 6, 2010 Author Share Posted December 6, 2010 Oh that's awesome! thank you so much Haku! They should build you a statue Cheers! Link to comment https://forums.phpfreaks.com/topic/220765-i-entered-an-infinited-loop-of-confusion-selectors-order/#findComment-1143617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.