Attributes

When adding attributes to an element in HTML, does it matter what order you put the attributes in? Is there a best practice?

1 Like

No, i don’t think it matters (as a rule of thumb) there might be some somewhere where it does, but the usage docs would likely call that out

1 Like

It only matters in JS for example when opening a page in Javascript:

window.open("https://codecademy.com", "_blank") //Javascript
<a id="myId" class="myClass" href="https://codecademy.com" target="_blank"></a> //HTML
//can be changed:
<a class="myClass" href="https://codecademy.com" id="myId" target="_blank"></a>

Hope this helps :grinning: