Home >Web Front-end >HTML Tutorial >How to make links in html
Creating a link in HTML requires three steps: first define the link tag () and set the href attribute to specify the link target; secondly define the link text as clickable text; finally you can add other attributes, such as target , title and rel to control link behavior.
How to make a link in HTML
Creating a link in HTML is simple and easy, just follow these steps:
1. Define link tag ()
<code class="html"><a href="URL">链接文本</a></code>
Where:
2. Set the href attribute
The href attribute specifies the full path of the target URL. It can be an absolute URL (starting with http:// or https://) or a relative URL (relative to the current web page).
3. Define link text
Link text is the text that is actually displayed on the web page and available for users to click. It can be simple text, an image or other element.
Example:
Create a link to the Google homepage:
<code class="html"><a href="https://www.google.com">Google</a></code>
Create a link to a page named "about.html" in the current directory :
<code class="html"><a href="about.html">关于我们</a></code>
Other attributes
In addition to the href attribute, the tag also supports other attributes, such as:
The above is the detailed content of How to make links in html. For more information, please follow other related articles on the PHP Chinese website!