Image Element and Attributes  <img  />   

Stop SignInserting web images adds interest to the web page and emphasizes contextual meanings. At this time all graphic browsers display three image formats. Image <img /> is a single element that needs to be closed after the attributes.

Insert an image on the page :

<img src="images/roses.jpg" alt="Roses" />

AttributesDescriptions
img="..." Places an image in the document
src="..." Identifies image file name
alt="..." Describes image for non-graphic browser, displays pop-up title
name="..." or id="..."Titles the image. Needed for JavaScript, replaced with id
height= Image height dimensions in pixels or percent
width=Image width in pixels or percent; use pixels
*border= Border thickness measured in pixels
Use CSS border property
*align="..." float:leftAlign image with text: center, left and right
Use CSS Float property
*hspace=Horizontal (top and bottom) space around the image in pixels Use CSS margin or padding properties
*vspace=Vertical (left and right) space around the image in pixels

*Deprecated attributes have been replaced with Cascading Style Sheet rules and properties

Insert an image on the page :

<img src="images/email.gif" alt="Email img" height="80px" width="80px" />

CSS Image Attributes

Use CSS rules to align the image and add padding with borders

Email img <style type="text/css">
img{float:left; height:80px; width:80px; padding: 5px; border:3px inset #ffcccc}
</style>
Web Design with XHTML Part I
Doris Cuffey, Instructor