Learn more about anchor tags

Source: Internet
Author: User
Tags reference window
The hyperlink <a> tag represents a link point, which is shorthand for the English anchor (anchor). Its role is to connect the current position of text or pictures to other pages, text or images, which is well-known, but the grammatical structure of it may be a little bit unknown, but to live it must understand its grammatical structure.

The basic syntactic structure of the <a> tag is as follows:

<a
Class=type
Id=value
Href=reference
Name=value
Rel=same|next|parent|previous
Rev=value
Target=window
Style=value
Title=title
Onclick=function
Onmouseout=function
onmouseover=function> The code that displays text or pictures </a>

From the grammatical structure of the tag, you can see that when you set up a hyperlink there are many parameters to choose from to achieve different link effect, this is a bit unexpected?!

Class and ID The ID number used to set the type and allocation of the link point is not normally set. The two most commonly used parameters are href and name. which
Href HREF is the acronym for Hypertext Reference, which is used to set the link address, which can be an absolute path or a relative path.
If the link target is an HTML file, it opens directly in the current browser If the executable file (. exe file) is executed or downloaded directly, we provide the downloaded file with this feature; If you are a text file such as a file in Word format, open the file in a browser and edit it.
Rel Indicates the relationship of the set link:
Rel=same indicates that the file to be linked is the same as this file,
Rel=next indicates that the file to be linked to is the next page,
Rel=parent represents this file as the parent file for the file to be linked,
Rel=previous indicates that the file you want to link to is the previous page.
Rev Used to set the reverse link.
Target Set the target window after the link is opened, such as target= "_blank" means opening a new window to open the page.
Title The caption text that is displayed when the link contact is selected.
OnClick Corresponds to an event that triggers the event when the link is clicked and executes the corresponding subroutine.
onmouseover Similar to the onclick, the corresponding event is triggered when the mouse moves over the chain contact.
onmouseout The corresponding event is triggered after the mouse is moved out of the town contact.


Give a few examples:

<a Href= "index.htm" > back to Index.htm home </a>
<a Href= "Sound.wav" to play a voice file </a>
<a Href= "Javascipt.open ()" To execute the corresponding program </a>
<a Herf= "Document.doc" to open the corresponding document for processing </a>

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.