Home > Web Front-end > HTML Tutorial > What new attributes are added to the a tag in HTML5

What new attributes are added to the a tag in HTML5

清浅
Release: 2018-12-04 09:18:07
Original
6146 people have browsed it

The new attributes of the a tag in HTML5 include charset, shape, coords, downloadNew, etc. to modify the link style

The a tag in HTML5 has added many new attributes. Many new functions and styles have been added to hyperlinks. Today I will introduce in detail the attribute values ​​​​in the new a tag in HTML5

HTML5 The main function of the tag is to be used for hyperlinks. You can link to other pages or other local files. The most important attribute of the element is the href attribute, which specifies the target of the link. If there is no href attribute, you cannot use attributes such as target and type.

【Recommended course: HTML5 course

What new attributes are added to the a tag in HTML5

##Example:

<a href="http://www.php.cn/">PHP中文网</a>
Copy after login

The difference between HTML and HTML5 is that the tag in html can be either a hyperlink or an anchor point, but in HTML5 the tag is a hyperlink. Link

New attribute of tag in HTML5

charset: not supported by html5, refers to the character encoding of the url

coords: not supported by html5 , refers to the coordinates of the link.

downloadNew: Specify the download link

hreflang: The base language of the target URL, only used when the href attribute exists.

mediaNew: The media type of the target URL, only used when the href attribute exists and the default value is all.

name: HTML5 does not support the name of the anchor.

rel: Not supported by html5, refers to the relationship between the target URL and the current document.

shape: Not supported by html5, refers to the shape of the link.

taget: refers to where to open the target URL, only used when the href attribute exists.

type New: Specifies the MIME type of the target URL, only used when the href attribute exists.

Case Sharing

Create a link shape for a star image with a circle shape


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<img  src="images/12.jpg" usemap="#xingxing" alt="What new attributes are added to the a tag in HTML5" >
<map name="xingxing" id="xingxing">
  <area href="https://baike.baidu.com/item/%E6%98%9F%E6%98%9F/5683398?fr=aladdin" shape="circle" coords="96,195,10" target="_blank"></area>
 </map>
</object>
</body>
</html>
Copy after login

Before clicking


What new attributes are added to the a tag in HTML5

After clicking

What new attributes are added to the a tag in HTML5

When you click on this coordinate circle, the a link will jump to the link specified by the a tag.

Summary: The above is the entire content of this article, I hope it will be helpful to everyone's learning.



The above is the detailed content of What new attributes are added to the a tag in HTML5. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template