HTML Links Elements

HTML Links – Hyperlinks

HTML links are hyperlinks.

You can click on a link and jump to another document.

When you move the mouse over a link, the mouse arrow will turn into a little hand.

HTML Links – Syntax

The HTML <a> tag defines a hyperlink. It has the following syntax:

The most important attribute of the <a> element is the href attribute, which indicates the link’s destination.

The link text is the part that will be visible to the reader.

Clicking on the link text, will send the reader to the specified URL address.

Example

Result

HTML Links

Visit Codenbytes.com!

 

HTML Links – The target Attribute

By default, the linked page will be displayed in the current browser window. To change this, you must specify another target for the link.

The target attribute specifies where to open the linked document.

The target attribute can have one of the following values:

Example

Result

The target Attribute

Visit CodenBytes!

If target=”_blank”, the link will open in a new browser window or tab.

 

HTML Links – Use an Image as a Link

To use an image as a link, just put the <img> tag inside the <a> tag:

Example

Result

Image as a Link

The image below is a link. Try to click on it.

 

HTML tutorial

 

The HTML <link> Element

The <link> element defines the relationship between the current document and an external resource.

The <link> tag is most often used to link to external style sheets:

Example

 

HTML NavigationElements

HTML Lists 

Unordered HTML List

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag.

The list items will be marked with bullets (small black circles) by default:

 

Ordered HTML List

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.

The list items will be marked with numbers by default:

Example

Result

An Unordered HTML List

An Ordered HTML List

  1. Coffee
  2. Tea
  3. Milk

 

HTML <li> Tag

Definition and Usage

The <li> tag defines a list item.

The <li> tag is used inside ordered lists(<ol>), unordered lists (<ul>), and in menu lists (<menu>).

In <ul> and <menu>, the list items will usually be displayed with bullet points.

In <ol>, the list items will usually be displayed with numbers or letters.

Example Navigation Bar

Result

Basic HTML code for Navbar

Note: We use href=”#” for links. In a real website this would be URLs.