8 of 133 menu

The a tag

The a tag creates a link to another page on your own or someone else's site. The link address should be written in the href attribute. Links are underlined by default. You can cancel the underlining using the CSS property text-decoration.

Attributes

Attribute Description
href The address of the page the link refers to.
Required attribute.
target Tells the link which tab to open in: a new one, the current one, or a frame.
Optional attribute.

Values ​​of the target attribute

Meaning Description
_blank The page will open in a new browser tab.
_self The page will open in the current browser tab.
_parent The page will open in the parent frame.
_top Discards all frames and loads the page in a full browser window.

Default value: _self.

Example

Let's make a link that will lead to the main page of the site google.com. It will open in a new browser tab, because we will set the attribute target to the value _blank:

<a href="http://google.com" target="_blank">google.com</a>

:

See also

  • pseudo-class link,
    which sets the style for an unvisited link
  • pseudo-class visited,
    which sets the style for a visited link
  • pseudo-class hover,
    which sets the style for a hover link
  • pseudo-class active,
    which sets the style of the link in activation
  • pseudo-class focus,
    which sets the style of the link in focus
byenru