Kovo Posted December 17, 2009 Share Posted December 17, 2009 HelloIm wondering what is the best practice for using qualified selector statements.Take these examples: #mv_bottomcontainer.oncelogged #left div.mv_smallGrayBoxCont div.mv_smallGrayBoxMiddle #cib_bar div.left{color:white;font-size:12px; etc....} #mv_bottomcontainer.oncelogged #left #cib_bar div.left{color:white;font-size:12px; etc....} #cib_bar div.left{color:white;font-size:12px; etc....} All three examples should result in the same elements getting styled. But which is more performant? Which would allow for faster page rendering times?Thanksps. I know we are probably talking milliseconds of difference here, but as a whole-er stylesheet it would make seconds of difference! Link to comment Share on other sites More sharing options...
Ingolme Posted December 17, 2009 Share Posted December 17, 2009 It's pointless to have an ID selector under a descendent selector, since you're completely sure that you're only going to have one element with that ID in the whole document. That's to begin with.The difference between one selector and another isn't in milliseconds, but microseconds, so it doesn't make a difference even if you have five stylesheets of 30kb each. The total time will be practically the same no matter how ridiculously long you make the selectors. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.