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 trialAndy Saini
5,287 PointsDoes the order of href/rel attributes matter? Does it matter for any number of attributes, anywhere in HTML?
Any example(or counterexample) shall be helpful.
2 Answers
Richard Cain
Courses Plus Student 9,029 PointsNo, the order of attributes does not matter. You can mix them up anyway you want and they will still be read correctly.
This:
<a href='http://www.damncoolpictures.com/favicon.ico' rel='icon' type='image/x-icon'/>
would be the same as:
<a href='http://www.damncoolpictures.com/favicon.ico' type='image/x-icon' rel='icon' />
Kevin Korte
28,149 PointsI don't think it does. Consistency is always nice from a human readable standpoint, but as far as whether the browser care, I don't think it cares the order off attributes on any elements, as long as it's valid. Somebody might prove me wrong with documentation, but I think that's correct.
Richard Cain
Courses Plus Student 9,029 PointsRichard Cain
Courses Plus Student 9,029 PointsIt keeps erasing my examples for some reason.
Andy Saini
5,287 PointsAndy Saini
5,287 Pointshave you put in example(s) in your answer? it's not displaying anything after This: & would be the same as: ...
Colin Marshall
32,861 PointsColin Marshall
32,861 PointsI fixed your answer so the code displays properly. Please see the Markdown Cheatsheet for instructions on how to post code on the forum. Thanks!