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 trialPeter Campbell
18,085 PointsWhy paste SVG code at the top of the body?
In the video, Nick pastes the SVG code at the top of the body. Is it closer to optimal perceived performance if the SVG files are pasted in just before they are used? My understanding is that in this case the SVG icons are in the footer and the browser would need to parse the SVG code before rendering the more important elements of the page.
1 Answer
Dale Bailey
20,269 PointsYou may be using it in several places around a page like on the contact page, so would you put it above the contact box or footer? The safe bet and best practice would be at the top of the document. Its still going to be much faster than several http requests and ideally you would want visual assets loaded early on.
To be honest the files are so small for little icons like this so you probably wouldn't even notice. I personally would link it for the sake of one small http request to keep my html clean.