click link. Newbies, please take a look."/> click link. Newbies, please take a look.">

Home  >  Article  >  Web Front-end  >  Beginner's article: How to use the tag to create a link (share)

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="//m.sbmmt.com">php中文网</a>

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></h1>The code example is as follows

<a href="//m.sbmmt.com">
<h1>我是PHP中文</h1>
</a>

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

<a href="//m.sbmmt.com">
<img  src="https://img.php.cn/upload/image/682/458/838/1627535900680707.jpg"    style="max-width:90%"  style="max-width:90%" alt="Beginner's article: How to use the <a> tag to create a link (share)" >
</a>

The code rendering is as follows

Beginners article: How to use the <a> 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

The above is the detailed content of Beginner's article: How to use the tag to create a link (share). For more information, please follow other related articles on the PHP Chinese website!