Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is href required on links? [duplicate]

I'm asking this because I have some links that act like buttons that pull out content trough ajax, so I don't need any href on them.

(I'm asking this from the SEO perspective)

like image 458
Alex Avatar asked Jan 23 '12 11:01

Alex


People also ask

Can you have a link without href?

An a[href] element is a link (which is why they are matched with :link in css). links are clickable. An a element without the [href] attribute is otherwise just a placeholder for where a link might otherwise have been placed, and not clickable, nor are they in the tabbing order of the page.

Is href attribute mandatory?

Anchor tag (HTML A tag) attributes Some attributes are optional like 'target=', but the href attribute is mandatory in order to create functional links.

Does anchor tag require href?

HREF is required when an anchor tag needs to be a hyperlink.

Why do we use a href in HTML?

The HTML <a> href Attribute is used to specify the URL of the page that the link goes to. When the href attribute is not present in the <a> an element that it will not be a hyperlink. This attribute is used to specify a link to any address.


1 Answers

I am assuming that by "links" you simply mean a elements. If that's true then:

No. At least, not in the HTML5 draft specification:

If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant.

From the HTML 4.01 specification:

Authors may also create an A element that specifies no anchors, i.e., that doesn't specify href, name, or id. Values for these attributes may be set at a later time through scripts.

like image 186
James Allardice Avatar answered Sep 22 '22 07:09

James Allardice