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 CSS Basics (2014) Getting Started with CSS External Style Sheets

Andy Saini
Andy Saini
5,287 Points

Does 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
PLUS
Richard Cain
Courses Plus Student 9,029 Points

No, 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' />
Andy Saini
Andy Saini
5,287 Points

have you put in example(s) in your answer? it's not displaying anything after This: & would be the same as: ...

Colin Marshall
Colin Marshall
32,861 Points

I fixed your answer so the code displays properly. Please see the Markdown Cheatsheet for instructions on how to post code on the forum. Thanks!

Kevin Korte
Kevin Korte
28,149 Points

I 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.