Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: Does it render "ul > li" faster than "ul li"?

using ">" rather than " " make the rendered faster as I heard from few people?

.slide:hover > div > span {
  border-color: #c8c8c8;
}

OR

.slide:hover div span {
  border-color: #c8c8c8;
}

Thanks a lot!


update: question

any reliability problem for any of this?

like image 682
designer-trying-coding Avatar asked Apr 15 '11 08:04

designer-trying-coding


1 Answers

You should very seriously reconsider listening to the people who tell you this type of thing.

The difference is utterly insignificant at best. No one should waste time, energy, or brainpower considering such things. This isn't a useful optimization. Don't fall into the trap of premature optimization, especially for a dynamic language like HTML/CSS.

Write code that is clear, maintainable, and functional first, before worrying about anything else.
If ul > li looks clearer to you than ul li, then write it that way. If not, don't. Keep it simple.

like image 191
Cody Gray Avatar answered Sep 30 '22 11:09

Cody Gray