Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class or href attribute first?

Tags:

html

anchor

When using an anchor tag, is it best practice to put the class first or the href?

<a class="this-class" href="#">Home</a>

OR

<a href="#" class="this-class">Home</a>
like image 904
seandaniel Avatar asked Jul 28 '26 13:07

seandaniel


1 Answers

The order is irrelevant, but it is good practice to pick an order (i.e. href then class) and keep it consistent throughout your application.

like image 99
dcortes Avatar answered Jul 30 '26 01:07

dcortes