HTML Images

Published by Rachel on

HTML, or HyperText Markup Language, is the language that web pages use to display their content. It’s made up of different elements which tell the web browser how to show it’s information. In today’s online world, understanding how websites work is crucial. Here are the only basics you need to know about HTML images!



Images

HTML images link to pages instead of inserting into them. The ‘<img>’ tag is used to embed it into the website. It creates a space for the image to insert into.

The ‘<img>’ tag doesn’t have a closing tag, but it does have two required attributes; ‘scr’ which specifies name and directory of the file and ‘alt’ which specifies alternate text for the image.

<img src = "image.jpg" alt = "This is a description of the image" >

Width and Height

You can specify image width and height two different ways. You can use the ‘width’ and ‘height’ attributes directly, or you can specify the width and height by using the ‘style’ attribute.

<img src = "image.jpg" alt = "This is a description of the image" width="100" height="100" >

<img src = "image.jpg" alt = "This is a description of the image" style = "width:100px; height:100px;" >

Link

If you want to link an image to another page or site, then include the normal ‘<img>’ tag within a normal ‘<a>’ tag.

<a href="https://www.rachel.ie/">
    <img src = "image.jpg" alt = "This is a description of the image" width="100" height="100" >
</a>


Read more about programming here!


Share:

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *