Home >Web Front-end >HTML Tutorial >Html grammar study notes 2_html/css_WEB-ITnose
1. Image tag () and source attribute (Src)
In HTML, images are defined by the tag.
is an empty tag, which means that it only contains attributes and has no closing tag.
To display an image on the page, you need to use the source attribute (src). src refers to "source". The value of the source attribute is the URL address of the image.
The syntax for defining an image is:
<img src="url" />The URL refers to the location where the image is stored. If an image named "boat.gif" is located in the images directory of www.w3school.com.cn, its URL is http://www.w3school.com.cn/images/boat.gif.
<img src="boat.gif"alt="BigBoat">When the browser cannot load the image, the replacement text attribute tells readers the information they lost. At this point, the browser will display this alternative text instead of the image. It's a good practice to add the alt text attribute to all images on the page. This helps display information better and is very useful for those who use text-only browsers.
2,