Beginner's article: How to use the tag to create a link (share)

奋力向前
Release: 2021-07-30 17:15:48
Original
5455 people have browsed it

In the previous article "Teach you step by step how to use the img tag to add image effects (knowledge)", I introduced you how to use the img tag to add image effects. The following article will show you how to create an click link. Newbies, please take a look.

Beginner's article: How to use the <a> tag to create a link (share)

# Tag: It is a hyperlink tag in HTML, usually starting with " " appears in pairs.

Function: is to jump to the page. Jump to a new page by clicking a line of text. It is the core function of HTML.

href attribute: Specify the link address and specify the text to be displayed inside the element.

The code example is as follows

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

The code rendering is as follows

Beginners article: How to use the <a> tag to create a link (share)

##

Not only can it contain text, You can also include other elements, such as <h1>The code example is as follows

<a href="https://www.php.cn">
<h1>我是PHP中文</h1>
</a>
Copy after login

The code rendering is as follows

Beginners article: How to use the <a> tag to create a link (share)Can contain pictures (the previous article has detailed description of picture elements).

The code example is as follows

The code rendering is as follows

tag to create a link (share)" > tag to create a link (share)" title="162763474027335Beginners article: How to use the tag to create a link (share)" alt="Beginners article: How to use the tag to create a link (share)"/>Click any of the links above and you will find that the new page will be on the current page Open, the current page will be overwritten. Sometimes we don't want the current page to be overwritten. Can we let it open in a new tab?

No problem, we can use the target attribute to specify the click jump method.

target attribute

: There are a total of the following values, of which the first two are the most commonly used

  • _blank

    : In new Open in window;

  • _self

    : Default. Open in the same frame;

  • _parent

    : Open in the parent frame set;

  • _top

    : Open in the entire window.

  • parent and top two items involve