Internal Hyperlinks

Description

You can create hyperlinks that bring another element into view in the browser window.

Example

You create internal hyperlinks using the CSS-style ID selector, #id, as shown in the following code.


<!DOCTYPE HTML>
<html>
<body>
  You can see other tutorials I like<!--from www .ja v a2  s . co m-->
  <a href="#tutorial">here</a>.
  <br />
  <br />
  <br />
  <br />
  <br />
  <br />
  <p id="tutorial">This is a test.</p>
</body>
</html>

Click to view the demo

The code above created a hyperlink with the href value of #tutorial.

When the user clicks the link, the browser will look for an element in the document whose id attribute has a value of tutorial. If the element isn't already visible on the screen, the browser will scroll the document to show it.

If the browser can't find an element with the desired id attribute value, it will search again, looking for a name attribute that matches the target.





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed