HTML/Training/Link options

From W3C Wiki
< HTML‎ | Training
Revision as of 22:36, 21 July 2011 by Plehegar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Link options

In which window to open the link document

In which window to open the link document is specified by the target attribute.
If you would like to open new window, you should use "_blank" for value of the target attribute.

 <a href="http://www.csail.mit.edu/" target="_blank">MIT</a>
  • _blank: Open the new window.
  • _self: Open the current one.
  • _parent: Open the parent browsing context of the current one.
  • _top: Open the most top-level browsing context of the current one.


Link that specifies position of Web page

Link that specifies position of Web page is specified by the id attribute.
The id attribute specifies that its a element is a named hyperlink, with the name given by the value of this attribute.

1. Specifies the id attribute.

 <h2 id="top">Top</h2>

note: The id attribute can be specified for any tag.


2. The a element with the href attribute. Value of the href attribute is a named hyperlink that you would like to link.

 <a href="#top">Go back top</a>


Challenge

1. Specifies the name linked anchor by the id attribute.

[menu.html]

 <h2 id="food">Food</h2>
 <h2 id="drink">Drink</h2>

2. Specifies the link text by <a>.

[menu.html]

 <p><a href="#food">Food</a> | <a href="#drink">Drink</a>

Hyperlink02.png


In the next content, embeds the images in the HTML documents. "Images"