Inserting images in HTML

Página 6

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: alternative_text 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: My image 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: My image 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:

7Links in HTML

Earn your Certificate for this Course for Free! by downloading the Cursa app and reading the ebook there. Available on Google Play or App Store!

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text