HTML and CSS Reference
The <a> element has a number of available attributes. These are described in the following sections.
The href Attribute
Every <a> element will usually include at least one attribute—commonly the href attribute. The href attribute
should contain a valid URL that points to the file that you are linking to. If the file is on the same domain, this may
be a relative path ( about.html ) or it may be an absolute path ( http://example.com/about.html ).
If you are linking to a particular element within a document, you may also use the ID of that element prefixed with a
pound sign ( # ), as shown in the preceding code example.
The title Attribute
The title attribute is used to provide a description of the link. If you hover over the link with your mouse cursor,
the title text will be displayed in a tooltip.
<a href="http://google.com" title="The Google search engine">Google</a>
Using the title attribute also makes your web pages more accessible to users that rely on assistive technologies
such as screen readers. These programs can read aloud the contents of the title attribute to give the user more in-
formation about the page you are linking to.
The rel Attribute
The rel attribute is used for defining the relationship of the current page to the page that is being linked to. For ex-
ample, rel=”author” indicates that the linked page includes information about the author of the current page.
You will look more at the different link types that are available in the “Link Types” section coming up shortly.
The target Attribute
The target attribute is used to instruct the browser how it should follow a link. If you want the browser to open
the link in a new window/tab, use _blank as the target.
<a href="http://google.com" target="_blank">Google</a>
Clicking on this link would open the Google home page in a new tab. Using _self will instruct the browser to open
the link in the current window. Most browsers will open links in the current window by default unless you specify
The download Attribute
You can use the download attribute to tell the browser that it should prompt the user to download a file and
not display the file in the browser window. This is particularly useful when you want to provide a download link for
in HTML5 and therefore browser support is currently limited.
You don't need to specify any content for the download attribute; its presence is enough to trigger a download.