Order of element attributes

https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door

Assign this <img> element an id attribute with the value of door1 . Place this id before the src .

Is the order of attributes significant? Are there best practices to be followed? What difference does the order of element attributes make?

Makes no difference whatsoever.

That said, one might want consistency in the code. It would help spot things quicker, and help others read/understand the code faster. Other than that, it doesn’t change a thing code-wise.

And no best practices as far as I know. Just pick an order and stick to it throughout your code :wink:

3 Likes