Home > Back-end >  Where does the class go inside of an anchor Href?
Where does the class go inside of an anchor Href?

Time:05-01

I am working on a program in HTML and I am wondering where the "class" keyword goes inside the <a> tag with an href. Currently, I have it written out as:

<a href="Order.html" class = "btn btn-dark">Order Now</a>

but am not sure if the class goes before, after, or where I have it currently.

CodePudding user response:

The order does not matter. You can put it wherever you prefer.

Both of these will work fine.

<a href="Order.html" >Order Now</a>

<a  href="Order.html">Order Now</a>

CodePudding user response:

There isn't any designated order for where the attributes are supposed to go.


Normally, for an <a> tag, it's a standard to place the href attribute first.

<a href="Order.html" >Order Now</a>

However, it won't cause any issues if you place class first.

<a  href="Order.html">Order Now</a>

In conclusion, there won't be any differences in the order of attributes. However, it is a standard practice to place href first.

  • Related