# HTML Images

# **HTML Images**

- Images can improve the design and the appearance of a web page.



# **👉** HTML Images Syntax

- The HTML `<img>` tag is used to embed an image in a web page.
- Images are not technically inserted into a web page; images are linked to web pages. The `<img>` tag creates a holding space for the referenced image.
- The `<img>` tag is empty, it contains attributes only, and does not have a closing tag.
- The `<img>` tag has two required attributes:
- src - Specifies the path to the image
- alt - Specifies an alternate text for the image

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666981329809/zYnfLNbh3.png align="left")

# **👉** The src Attribute

- The required `src` attribute specifies the path (URL) to the image.
- You can use the `style` attribute to specify the width and height of an image.

**👉** Example➖


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666981482358/QOyKIWy5B.png align="left")

# **👉** The alt Attribute

- The required `alt` attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
- The value of the `alt` attribute should describe the image:
- If a browser cannot find an image, it will display the value of the `alt`
 attribute:

**👉** Example➖

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666981501716/S2_KT3_rX.png align="left")

-----------------------------------------------------------------------------------------------
![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1666336375150/5HqI8zNVh.png align="left")> 
Download our HTML & CSS Visual Treat! ebook Here: 
[Click here](https://codemarch.gumroad.com/l/hxazr)

