How to add image path in html

coldplay.xixi
Release: 2021-01-25 13:58:41
Original
12661 people have browsed it

How to add an image path in html: First create a new html file and insert the img tag in the body tag; then add the "alt" attribute to the img tag; finally, the width and height of the image inserted in the img tag default to the image itself. width and height.

How to add image path in html

The operating environment of this tutorial: windows10 system, html5 version, DELL G3 computer. This method is suitable for all brands of computers.

Related learning recommendations:html tutorial

htmlHow to add image path:

1. Create a new html file, such as As shown in the figure, insert the img tag into the body tag. It should be noted that img does not have an end tag in html, so there is no need to add "". Add the "src" attribute to the tag, and fill in the attribute value with the path to the image you want to add. Here we take 1.png in the same directory as html as an example, so that the image is inserted:

How to add image path in html

2. In order to prevent users from being unable to load images when browsing the web, you can add the "alt" attribute to the img tag. This attribute can be displayed when the image fails to load to tell the user what image is here. It can also be used when the user When the mouse is placed on the picture, the prompt information is displayed. Here, the attribute value "parrot" is taken as an example:

How to add image path in html

3. The width and height of the picture inserted in the img tag default to the picture itself. The width and height. If you want to customize the width and height, you can use "width" and "height" to control it. Here, take the width and height as both 200 as an example. Set the attribute values for "width" and "height" to " 200”:

How to add image path in html

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

Related labels:
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
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!