logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
Spirituality
Home Improvement
Vegetarian
NASCAR
Southcentral USA


dailyclick
All times in EST

Low Carb: 8:00 PM

Full Schedule
g
g HTML Site
Elizabeth Connick
BellaOnline's HTML Editor

g

The HTML Image Tag - 2
Guest Author - Diane Cipollo

Let's look at some working examples. The first is an example of what I call the "bare bones" image tag and it looks like this.

<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker">
Note--The arrow indicates that the code is wrapped to a second line and should really be all on one line.

Clicker
Clicker
Clicker
Example 1

Example 1. As you can see the only attributes that are specified are the width, height, and alt. Therefore the browser will use the defaults for all the other attributes. The first image of Clicker in this example is a simple image and not a link button (also called a hyperlink). So the browser has not placed a border around this image. The second image of Clicker is a link button. If you click on it, you will just be returned to this page. So don't bother. But it shows how the browser automatically puts a border around any image that functions as a link button. To override the automatic border, you have to add the attribute/value pair of border="0". That is what I have done for the third image of Clicker in this example.

In the following examples I have placed a one pixel wide border (border="1") around each image so that you can better see the effects of the other attributes.

Example 2. You can control the vertical space between the image and the surrounding text with the vspace attribute. In this second example, I have used the following code to add 20 pixels of space above and below the image.

<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" vspace="20">
Note--The arrow indicates that the code is wrapped to a second line and should really be all on one line.

DigitalNewsvspace="20"
Example 2

Example 3. Now for the third example, you are probably one step ahead of me and have figured out how to add a space on the right and left of the image. You would use the hspace attribute to control the horizontal space.

<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" hspace="20">
Note--The arrow indicates that the code is wrapped to a second line and should really be all on one line.

DigitalNewshspace="20"
Example 3

Example 4. This example demonstrates how to control the vertical alignment of the first line of text in relation to the image. Depending on the image and the neighboring text, you may want to place this line at the top, middle or bottom of the image. You will use the align attribute to do this. As you can see this only controls the first line of text.

<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" align="top">
<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" align="middle">
<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" align="bottom">
Note--The arrow indicates that the code is wrapped to a second line and should really be all on one line.

ClickerDepending on the image and the neighboring text, you may want to place this line at the top, middle or bottom of the image.

align="top"
ClickerDepending on the image and the neighboring text, you may want to place this line at the top, middle or bottom of the image.

align="middle"
ClickerDepending on the image and the neighboring text, you may want to place this line at the top, middle or bottom of the image.

align="bottom"
Example 4

Example 5. The last example demonstrates how to align the image either to the right or left margin. Again you would use the align attribute to do this.

<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" align="right">
<img src="images/Clicker.jpg" width="89"
height="69" alt="Clicker" align="left">
Note--The arrow indicates that the code is wrapped to a second line and should really be all on one line.

Clicker
align="right"
Clicker
align="left"
Example 5

As you can see you can have a lot of control of how the image is displayed on your webpages.

← Back

|



RSS | Previous Features | Site Map


Content copyright © 2008 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Elizabeth Connick for details.

Digg! g delicious Save to Del.icio.us

g


For FREE email updates, subscribe to the HTML Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Setting Your Webpage Background

Multiple-Choice Input Fields for HTML Forms

The Right Way to Start a Paid Website Project

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Driving Amount
Much more
Slightly more
Slightly less
Much less

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2008 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor