Home  >  Article  >  Web Front-end  >  How to add links to images in html

How to add links to images in html

清浅
清浅Original
2019-04-09 17:17:2929334browse

htmlHow to add a hyperlink to an image: You can set the hyperlink through the tag, set the link to jump through href, and then set the How to add links to images in html tag under the a tag Used to add pictures. When the picture is clicked, it will jump to the target link.

Using hyperlinks in HTML can connect to another document on the Internet. We can find links in almost all web pages. Next, in the article, I will introduce how to add hyperlinks to pictures, which has a certain reference effect. I hope it will be helpful to everyone

How to add links to images in html

[Recommended Course: HTML Tutorial]

We can set a hypertext link through the tag, when the content is clicked It will jump to a new document or a certain part of the current document, and when the mouse pointer is placed on it, the arrow will change into the shape of a small hand

Grammar form

<a href="url">链接文本</a>

There is a target attribute in the a tag, which is specifically used to control how to jump. For example, when it is set to self, it means that it is used to jump in the current tab. When it is set to

blank, it means that the hyperlink is opened in a new window with the

a tag. An attribute title. The title in the a tag is the same as the title in the img tag. They are both used to control the content of the prompt text displayed when the mouse hovers.

Example: Add a hyperlink to an image

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<a href="http://www.php.cn" target="-blank" title="PHP中文网logo">
	<img  src="logo.jpg" alt="How to add links to images in html" >
</a>
</body>
</html>

The rendering is as follows:

How to add links to images in html

#When we click on the picture, it will jump to the official website of the PHP Chinese website. When the mouse moves to the picture The title we set will be displayed.

Reference for this article:https://www.html.cn/doc/html/link/

HTML tag index:https:/ /www.html.cn/sitemap.html

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



The above is the detailed content of How to add links to images in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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