HTML/Links

From Wikiversity
Jump to navigation Jump to search

Links are used to connect web pages together. They can do more than link, but for right now, we will focus on the basics.

The tag[edit]

A link is denoted by the <a> tag and requires a </a> closing tag. For example.

<a href="http://www.example.com">Example</a>

The text in between the <a> tag and the closed </a> tag is the text that the link will be displayed at. The example above will look like Example. The href="http://www.example.com" attribute, a characteristic with a value inside the opening HTML tag, is the thing that tells the link where the person is going to go when they click on it. In between the two quotes is the URL of where you want the link to go.

Anchors[edit]

Anchors can be used to create links to specific points in a html page.

Firstly, place <a name="Tag"></a> at the spot you want to link to.

Secondly, place <a href="#Tag">Hyperlinked text</a> to create a link on the same page or if its a link from a different page, use <a href="path#Tag">Hyperlinked text</a> e.g., <a href="http://...#Tag">Hyperlinked text</a> .