Links

The <a></a> tags are used to create link elements. Links can take the user to other parts of the document or another document entirely. For example, here is a link to Sonnet 29 further down the page. Here is a link to Sonnet 29 on wikipedia.

Relative and Absolute

Links can either be relative or absolute. Absolute links contain the full address of the resource being linked to. For example, the link to Sonnet 29 on wikipedia above is an absolute link, as it links to a resource on a completely different website. Links to other websites must always be absolute. Relative links link to content on the same website. For example, here is a link to the previous example looking at headings, paragraphs and line breaks.

In the previous example, we used 'lorem ipsum' text to fill up space to see how our paragraphs looked. If you don't know the lorem ipsum text off by heart, you can generate paragraphs and paragraphs of it at lipsum.com

Other link attributes

We can use the "target" attribute to change where the link is opened. Most typically, this is used to open a link in a new window, by setting the attribute value to "_blank". For example, this link to the documentation about the <a> element on the Mozilla Developer Network opens in a new window.

We can use the "download" attribute to specify a filename for a link we intend to be downloaded rather than opened in a browser. For example, we may want to download a pdf rather than opening it.

Sonnet 29

When in disgrace with Fortune and men's eyes,
all alone beweep my outcast state,
And trouble deaf heaven with my bootless cries,
And look upon myself and curse my fate,
Wishing me like to one more rich in hope,
Featured like him, like him with friends possess'd,
Desiring this man's art, and that man's scope,
With what I most enjoy contented least.
Yet in these thoughts myself almost despising,
Haply I think on thee, and then my state,
Like to the lark at break of day arising
From sullen earth, sings hymns at heaven's gate;
For thy sweet love remember'd such wealth brings
That then I scorn to change my state with kings.

Heading Level 4

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc a feugiat erat. Curabitur lacinia dolor magna, mollis efficitur sapien finibus tincidunt. Sed a dui vel erat ullamcorper laoreet sed lobortis eros. Aenean ut erat in augue condimentum ullamcorper. Vestibulum eget commodo urna, sed posuere mi. Cras molestie nisl nulla. Aliquam dictum neque ut nunc faucibus, nec blandit enim gravida. Nunc posuere suscipit felis, eget mattis lorem mollis id.

Nunc consectetur nec dui eget tincidunt. Duis suscipit dui ac nunc blandit, id sollicitudin augue efficitur. Quisque convallis iaculis imperdiet. In lobortis libero nibh, sed malesuada nibh finibus et. Ut justo nisl, pellentesque ut metus nec, aliquet sodales neque. Integer viverra scelerisque tortor nec fermentum. Vestibulum scelerisque purus urna, eget fermentum nisi scelerisque vitae. Vivamus ac urna sit amet lorem elementum vulputate. Curabitur rutrum ex elit, sed auctor neque suscipit blandit. Donec luctus diam odio, eu mattis metus maximus non. Nulla facilisi. Fusce ultricies nisl ut dapibus pulvinar. Duis quis neque feugiat nibh posuere eleifend ac sed sapien.

Nam vulputate neque vitae quam venenatis, non sagittis ipsum mollis. Duis eu hendrerit odio. Sed faucibus egestas libero, at dignissim metus accumsan in. Praesent aliquet malesuada turpis, ac accumsan neque feugiat id. Fusce a gravida enim. Donec eget semper purus. In non luctus ipsum, vel elementum elit. Donec sodales iaculis fermentum. Integer ut mattis nulla. Cras vulputate lacus pretium rutrum mollis. Duis varius nisl blandit neque sollicitudin, sed gravida ex cursus. Aenean tristique erat et nisi sagittis aliquam. Curabitur vitae dui blandit, lacinia tellus at, pretium quam. Aliquam suscipit pulvinar tellus. Phasellus ultricies scelerisque pharetra. Sed vestibulum nisi justo, sed suscipit metus efficitur eget.

Sed commodo vel urna in rhoncus. Integer iaculis elit neque, ac laoreet ligula tincidunt sed. Maecenas hendrerit ut tellus eu commodo. Quisque sed urna ut velit ornare ornare. Ut sodales augue vel venenatis porttitor. Nulla elit metus, rhoncus nec lorem vitae, pharetra dictum nibh. Sed blandit arcu eu dui cursus, non sodales nibh vulputate. Vivamus a sagittis erat. Suspendisse eget ipsum sit amet massa euismod facilisis eget ut tortor. Duis in sodales magna, aliquam volutpat nulla. Nulla dictum turpis et nibh facilisis condimentum.

Duis ut aliquam dui, quis semper orci. Maecenas maximus consequat lacus, et volutpat ante dignissim quis. Vivamus ac nibh vitae orci blandit placerat. In at leo nec velit facilisis ultricies. Fusce sodales libero vitae tellus sodales, pellentesque tristique diam egestas. Integer aliquam felis et ultrices viverra. Fusce id libero vitae erat faucibus rutrum quis ac lacus. In laoreet rutrum varius. Proin lectus lectus, tempus cursus eros varius, ultricies varius turpis. Ut sit amet ultrices nulla. Cras pretium hendrerit velit nec iaculis. Etiam ullamcorper tristique tellus a vehicula.