HTML

HTML Links w3school web

HTML Links w3school web

HTML Links w3school web, Links are found in essentially all site pages. Links permit clients to click their way from page to page.

HTML Links w3school web, 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.

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

<html>


<a href="url">link text</a>


</html>

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

This example shows how to create a link to W3Schoolweb.com:

<html>


<a href="https://www.w3schoolweb.com/">Visit W3Schoolweb.com!</a>


</html>

Tip: Links can obviously be styled with CSS, to get another look!

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:

  • _self – Default. Opens the document in the same window/tab as it was clicked
  • _blank – Open the document in a new window or tab
  • _parent – Document in the parent frame
  • _top – The document in the full body of the window

Example

<html>


<a href="https://www.w3schoolweb.com/" target="_blank">Visit W3Schoolweb!</a>


</html>

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

<html>

<a href="https://w3schoolweb.com/">
<img src="smiley.gif" alt="HTML tutorial" style="width:42px;height:42px;">
</a>

</html>

Chapter Summary

  • Use the <a> element to define a link
  • Use the href attribute to define the link address
  • Use the target attribute to define where to open the linked document
  • Use the <img> element (inside <a>) to use an image as a link
  • Use the mailto: scheme inside the href attribute to create a link that opens the user’s email program
HTML Links w3school web

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button