What are the attributes of the html img tag? Detailed explanation of image tag img

云罗郡主
Release: 2018-11-12 11:57:25
Original
18776 people have browsed it

Nowadays, any web page is inseparable from pictures. If a website is a web page that combines pictures and text, it will be loved by many users. If the website wants to get more traffic, it cannot do without pictures, so then Let’s take a look at the image tag img and summarize for you what are the attributes of the html img tag?

1: Introduction to image tag img

Generally, in html, we can use What are the attributes of the html img tag? Detailed explanation of image tag img to set the image. The img tag is There is no end tag for self-closing tags. We only need to master the three attributes of What are the attributes of the html img tag? Detailed explanation of image tag img and src, alt and title. [Recommended reading: Detailed explanation of img tag and changing image size in html (picture)]

1.src attribute is the file address of the image

2. The alt attribute is the text that appears when the picture is broken

3. The title attribute is the text displayed when the mouse is placed on the picture

Among the above three attributes, src and alt It is indispensable. Let’s explain these three attributes in detail below.

2: Detailed explanation of image tag img

1. The src attribute is an indispensable attribute for pictures. , generally the address source of the image, the syntax is:

What are the attributes of the html img tag? Detailed explanation of image tag img
Copy after login

2. The alt attribute in the img tag

alt attribute is actually also for search engines to see, the syntax is:

图片描述(给搜索引擎看) 
Copy after login

3.title attribute

The title attribute is the title of the image displayed when the mouse is moved over the image, allowing users to see the information about the image. Syntax: Picture description (for search engines)

For example:

 


    图像标签img

php中文网
Copy after login

Display effect in the browser:

What are the attributes of the html img tag? Detailed explanation of image tag img

What are the attributes of the html img tag? A complete introduction to the detailed explanation of the image tag img. If you want to know more about Html5 tutorial, please pay attention to the php Chinese website.


The above is the detailed content of What are the attributes of the html img tag? Detailed explanation of image tag img. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!