Warning:
This wiki has been archived and is now read-only.

Educational materials/Link options

From HTML Wiki
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>


try it

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

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

2. Specifies the link text by <a>.

 <ul>
   <li><a href="#food">Food</a><li>
   <li><a href="#drink">Drink</a><li>
 </ul>