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 trialTanner Cruiseship
5,707 PointsExplain syntax pls?
It seemed like Nick was just copying code from a bunch of files into one bigger file. He never explained what anything in the code was doing. So for instance on this bit of code:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 161.4 188.9" enable-background="new 0 0 161.4 188.9"><path d="M.7 50h158l-80 63zm98.7 53l-20.7 17-20.7-17-57.3 51h158zm-98.7-47v88.7l50.3-44.4zm158 0v88.7l-49.7-44.4z" fill="#A6A6A6"/></svg>
What are the <svg> tags with the url doing? Where did he get the coordinates for the viewbox? What are the rest of the tags for and where is the file with the actual image? I'm so lost...
1 Answer
Steven Parker
231,269 PointsAn SVG is an actual image. Unlike a raster image as you might have in JPG format, it is a vector image. The viewbox values and other tags were probably generated by a drawing program that was used to create the image.
Just paste the code into an HTML document and you can view the image in a browser. Here's a copy that I have enclosed in a DIV element to constrain the size:
<div style="width:200px">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 161.4 188.9" enable-background="new 0 0 161.4 188.9">
<path d="M.7 50h158l-80 63zm98.7 53l-20.7 17-20.7-17-57.3 51h158zm-98.7-47v88.7l50.3-44.4zm158 0v88.7l-49.7-44.4z" fill="#A6A6A6"/>
</svg>
</div>