Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is deep divs nesting hitting performance?

Tags:

html

I've started using DOM Monster, which is in general pretty cool and helpful. One of the warnings it gave me while analyzing a page I've built is that I have elements nested too deeply (more than 15 levels deep).

How badly is div nesting hitting performance of browsers? Should I put a major effort into minimizing nesting?

like image 241
MeLight Avatar asked Feb 03 '26 22:02

MeLight


1 Answers

It won't be a problem with modern browsers.

It shouldn't affect IE6 much - you should take into account a total number of div (elements, in general) as it will have more impact than just nesting of 20 elements. I've seen IE6 struggle with rendering ~1000 divs with smaller nesting.

In general I would advise rendering as little elements as possible, since this will help you with styling using CSS.

like image 176
Jakub Konecki Avatar answered Feb 05 '26 13:02

Jakub Konecki