Ashhad Iqbal
Ashhad Iqbal

Reputation: 71

Any perfomance issues due to display none?

The website I created has so much to hide in the mobile view. Will there be any problem on its performance by using too much display: none on a single page?

Upvotes: 1

Views: 593

Answers (4)

Tobi
Tobi

Reputation: 1438

I think there is a performance problem... not in rendering the page but in loading it over the internet. display: none does also load all the content for your mobile site which isn't neccessary? Try to remove it from the DOM and you got also performance for loading the site

Upvotes: 1

odedta
odedta

Reputation: 2478

Please note that a display of 'none' does not create an invisible box; it creates no box at all. CSS includes mechanisms that enable an element to generate boxes in the formatting structure that affect formatting but are not visible themselves. Please consult the section on visibility for details.

Reference

Doesn't create a box => more performance.

Upvotes: 0

Harsh
Harsh

Reputation: 1695

No There won't be any. But if you are really hiding stuff and a lots of it. Try to remove it from DOM all together instead of hiding it. Atleast that stuff which could have bindings or watches on it.

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

Reputation: 172438

No there is no performance difference due to the usage of the display:none. When you use display: none then you tell the Html engine to completely ignore the element and all his children. The elements are not in the render tree

Upvotes: 2

Related Questions