HTML A Tag

Reference on the HTML a Element.

The A Element is used to create links/anchors. You may also find the Tutorial entry Images and Links useful.

Note: Links are inline-elements, and needs to be inclosed in either <p> tags, or other block-level elements. I.E. (One of P, H1-H6, DIV, ADDRESS).

HTML a Element example

Note. For accessibility reasons its best to separate links with something like "-", or inclose them in unordered/ordered lists.

The first is just a single link, inclosed in p tags.

<p><a href="http://www.brugbart.com/">Brugbart in English</a></p>

The next is two links, (can be multiple), again inclosed in a single p element, but this time separated by "-".

<p><a href="http://www.brugbart.com/">Brugbart in English</a> - <a href="http://www.brugbart.dk/">Brugbart in Danish</a></p>

The last example is best for navigation menus, and incloses the links in li elements. In this case in an unordered list.

  <ul>
   <li><a href="http://www.brugbart.com/">Brugbart in English</a></li>
   <li><a href="http://www.brugbart.dk/">Brugbart in Danish</a></li>
   <li><a href="http://www.blueboden.com/">BlueBoden</a></li>
  </ul>

If using images as links, don't forget to make sure, that the links are accessible. Its a good idea to use the alt tags, since this will be what a screenreader reads when they encounter images as links.

Post comment

Links that you insert are not nofollowed, but will be removed by admins if they are considered spam.

[url=Absolute URL for page]TITLE[/url]

You should insert code boxes around code examples, which will be automatically syntax highlighted.

[code1 html|css|javascript|php|sql]Your Code Here[/code1]

You may want to read our Privacy Policy before submitting your comment.