HTML Images
Images can improve the design and the appearance of a web page.
HTML Images Syntax
In HTML, images are defined with the `<img>` tag. The `<img>` tag is empty, it contains attributes only, and does not have a closing tag.
The `src` attribute specifies the URL (web address) of the image:
<img src="url">
Image Example
Result
The alt Attribute
The `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:
Alt Attribute Example
Result
Image Size - Width and Height
You can use the `style` attribute to specify the width and height of an image.
Image Size with CSS
Result
Alternatively, you can use the width and height attributes. However, using the style attribute prevents style sheets from changing the size of images.