Inserting images in HTML
Page 6 | Listen in audio
To insert images in an HTML page, it is necessary to use the tag. This tag allows the image to be displayed on the page, and can be added anywhere in the HTML code. The first thing to do is choose the image that will be inserted. It is important that the image is saved in a web-compatible format such as JPEG, PNG or GIF. In addition, it is important that the image has an adequate size for the page where it will be inserted, so that it is not disproportionate or takes too long to load. To insert the image, it is necessary to use the tag, which has the following syntax: The src attribute indicates the image path, which can be an internet address or a relative path on the server where the page is hosted. For example, if the image is in the same folder as the HTML page, just put the image name in the src attribute, as in the example below: The alt attribute is used to describe the image in case of loading problems or for visually impaired users. It is important that the alt text is descriptive and makes the content of the image explicit. In addition, it is possible to add other attributes to the tag, such as the width attribute to define the width of the image in pixels, and the height attribute to define the height of the image in pixels. It is important to use these attributes carefully, so that the image does not look disproportionate or lose quality. You can also add a link to the image so that it redirects the user to another page or resource. To do this, just add the href attribute to the tag, as in the example below: This way, when clicking on the image, the user will be redirected to the destination page. In summary, inserting images in HTML is a simple and important task to make the page more attractive and informative. Using the tag and the appropriate attributes, you can easily and efficiently insert images.
Now answer the exercise about the content:
_What is the function of the "alt" attribute in the tag?
You are right! Congratulations, now go to the next page
You missed! Try again.
Next page of the Free Ebook: