Home >Web Front-end >HTML Tutorial >How to add external links to html
How to add external links in HTML
External links are links to web pages or files located outside the current web page. Adding external links in HTML is very simple, here are the specific steps:
1. Use the tag
To create an external link, use the tag, This tag contains the following attributes:
2. Link text
3. Example
To create a link that opens in a new tab pointing to google.com, the code is as follows:
<code class="html"><a href="https://www.google.com" target="_blank">Google</a></code>
4 . Using the target attribute
The target attribute allows you to specify where the link should be opened. Here are some common goals:
5. Add image links
You can also use images as links. To create an image link, use the tag and set its src attribute to the URL of the image and its href attribute to the target URL.
<code class="html"><a href="https://www.google.com" target="_blank"> <img src="google_logo.png" alt="Google" width="200" height="60"> </a></code>
Tip:
The above is the detailed content of How to add external links to html. For more information, please follow other related articles on the PHP Chinese website!