Friday 21 September 2012

HTML Images

The <img> tag and the src attribute

In HTML, images are defined with the <img> tag. 
The <img> tag is empty, which means that it contains attributes only, and has no closing tag.
To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display.

The alt attribute:

The required alt attribute specifies an alternate text for an image, if the image cannot be displayed.
The value of the alt attribute is an author-defined text: 

<img src="url" alt="some_text"/>

Set height and width

The height and width attributes are used to specify the height and width of an image.
The attribute values are specified in pixels by default:

<img src="yo.jpg" alt="Techo yo" width="304" height="228">


Align attribute:

 Align attribute can be used with images. eg. align="bottom"


No comments:

Post a Comment