Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Luke Lee
Luke Lee
7,577 Points

Do lots of display:none slow page speed?

When design responsive design, people like to use display:none for certain blocks. I think page still load these elements right?

3 Answers

Sri Kadimisetty
Sri Kadimisetty
9,770 Points

Yes. the element is loaded.

The style display:none removes the element from displayingg into the page, when the styles are applied by the browser (post page download). However that particular element will still be available for any Javascript DOM manipulation etc.

Kazimierz Matan
Kazimierz Matan
13,257 Points

Sri is right. These non-displayed elements are still loaded into DOM, content of them is loaded too. Page speed would be similar with or without "none" value of display property.

James Barnett
James Barnett
39,199 Points

In order to change that you would need to use a server-side language like PHP to do some device detection to know what content to serve up.

That's what some people have started calling RESS (Responsive + Server Side)

further reading

http://bradfrost.github.io/this-is-responsive/resources.html#ress