HTML link, html link

Source: Internet
Author: User

HTML link, html link

HTML uses a hyperlink to connect to another document on the network. You can find links on almost all webpages. Click the link to jump to another page.


Try-instance

HTML link
How to create a link in an HTML document.

(You can find more instances at the bottom of this page)

HTML hyperlink (Link)

HTML uses tags <a> to set hypertext links.

A hyperlink can be a word, a word, a group of words, or an image. You can click the hyperlink to jump to a new document or a part of the current document.

When you move the mouse pointer to a link on a webpage, the arrow becomes a small hand.

The href attribute is used in the tag <a> to describe the link address.

By default, links appear in the browser as follows:

  • An unaccessed link is displayed in blue with an underline.
  • The accessed link is purple and underlined.
  • When you click a link, the link is displayed in red and underlined.

NOTE: If CSS styles are set for these hyperlinks, the display styles are displayed based on CSS settings.

HTML link syntax

The HTML code of the link is very simple. It is similar to the following ::

<A href =" Url"> Link text</A>

The href attribute describes the Link Target ..

Instance <a href = "http://www.runoob.com/"> cainiao tutorial </a>

The above line of code shows: Visit cainiao tutorial

Click this hyperlink to bring the user to the home page of the cainiao tutorial.

Tip: "Link text"Not necessarily text. Images or other HTML elements can be links.

HTML link-target attribute

You can use the target attribute to define where the linked document is displayed.

The following line opens the document in a new window:

Instance <a href = "http://www.runoob.com/" target = "_ blank"> visit cainiao tutorial! </A>
Try again»

 

HTML link-id attribute

The id attribute can be used to create an HTML document bookmarks.

Tip:Bookmarks are not displayed in any special way and are not displayed in HTML documents, so they are hidden for readers.

Instance

Insert ID in HTML document:

<A id = "tips"> useful tips </a>

Create a link in the HTML document to "useful tips (id =" tips ")":

<A href = "# tips"> tips for access </a>

Or, create a link from another page to "useful tips (id =" tips ")":

<A href = "http://www.runoob.com/html/html-links.html#tips">
Access useful tips </a>

 

Basic Considerations-useful tips

Note:Always Add the forward slash to the subfolders. If the link is written like this: href = "http://www.runoob.com/html", two HTTP requests are generated to the server. This is because the server adds a forward slash to this address and then creates a new request like this: href = "http://www.runoob.com/html ".


More instances

Image Link
How to Use Image links.

Link to the specified location on the current page
How to use bookmarks

Jump out of Framework
This example shows how to jump out of the framework, if your page is fixed within the framework.

Create email link
This example shows how to link to an email. (This example can only work after installing the mail client program .)

Create email link 2
This example shows more complex email links.

HTML link tag

 

Tag Description
<A> Define a hyperlink

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.