Images are added to documents by using the <img> tag. The tag should always have four basic attributes src, alt, width, and height. For instance, to add the image below, the HTML markup would be:
<img src="images/family.jpg" alt="[Picture of My Family]" width="192" height="150">
![[My Family]](images/family.jpg)
The src tag shows the location of the document, and can be an absolute URL reference (if the image were somewhere on the WWW) or could be a relative URL reference (if the image were on your server).
The alt tag, which stands for alternative text, shows a textual description of the image. This will be displayed as the image is loading and as people mouse over
Image size should be used in all cases because it helps your browser render your pages quicker. The image sizes you set can be the actual size of the images, or can be scaled to different sizes:
|
|
|
|
|
|
||
There are two basic alignments your images can take: inline and floating. Inline images are displayed as part of the line in which it is declared while floating images are text-wrapped. All alignment is declared with the align attribute. For inline images, the values they can take are top, middle, and bottom. Floating images take values of left or right.
|
These are set with the align attribute:
|
||||||||||||
Adding BordersBy default, images do not have borders unless they are used as links. If you wish to insist on having one, it can be set with the border attribute. Examples of different border sizes are as follows:
Adding White Space to Images
|
||||||||||||
|
|
||||||||||||