HTML images


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">

- 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:

<img src="pic_trulli.jpg" alt="Italian Trulli">

- Image Size - Width and Height

You can use the style attribute to specify the width and height of an image.

```
<img src="img_girl.jpg" alt="Girl in a jacket" style="width:500px;height:600px;">
```

CSS colors

Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values.

  • can set text color;
  • can set border color
  • can set background color;
  • etc..

CSS text

This property defines everyting related to text.

  • can set color for text;
  • can set position for text;
  • can set Decoration for text;
  • can set Alignment for text;
  • can set Transformation for text;
  • can set Indentation for text;
  • can set Letter Spacing for text;
  • etc…