Aligning text and objects around images
Sponsored Links
The align attribute of <img> tag helps in aligning other elements like text with respect to the image. It can take any of the following values:
- top: Aligns the image to the top of adjoining object.
- middle: Aligns the text baseline to the middle of the image.
- bottom: Text baseline is aligned to the bottom of the image. This is the default value.
- left & right: Image is aligned right of left with text wrapping around it.
- absmiddle, absbottom and baseline: Aligns the image with respect to the middle, bottom or baseline of the text.
- texttop: Aligns the image top with respect to the ascenders of the text. This attribute value is Netscape specific.
- center: works same as align="middle".
However, a situation might arise when you would like to place only some text, say, a small description, on the left or right side of the image with the rest to flow after the image.
In our example, we want to align "What a fine idea!" to the left of the image with other sentences to be placed after the image.
If you use the following code, you shall not get the desired results.
<img src="bulb.gif" width="128" height="220" alt="Fine idea" align="right"> What a fine idea!<br>The bulb in this ...
What a fine idea!
The bulb in this image represents an idea that I have cherished over the months but did not get time to implement.
You'll notice that the next line - "The Bulb in this ..." - also lies to the left of the image, while we wanted to place it below the image.
To force the next line to place below the image, we use clear attribute of <br> tag with "all" as value. Thus, placing <br clear="all"> right after the phrase will force the next line to start at a new line.
<img src="bulb.gif" width="128" height="220" alt="Fine idea" align="right">< What a fine idea!<br clear="all">The bulb in this ...
What a fine idea!
The bulb in this image represents an idea that I have cherished over the months but did not get time to implement.
Page contents: Understanding web page formatting and how to align text and other objects on a web page around images using the ALIGN attribute of the HTML <IMG> tag.
Comments, questions, feedback... whatever!
Recent Articles
Recent Blog Posts
Popular Articles
- Hotmail Sign In page
- Create a Hotmail account - Instructions
- Create Gmail address
- Download and install Outlook Express
- Get your free Gmail address
- Outlook Express new version
- Create my own email address
- Browers for Windows list
- Get email address
- Color combinations for web sites and pages
- Create Yahoo ID
More web tips & tricks
- Outlook Express Help - tips & tricks (53)
- Windows Live Mail help and tips (36)
- Windows Mail help (25)
- Hotmail help and tips (42)
- Yahoo help & support (45)
- AOL email help (26)
- Gmail help and tips (36)
- Internet tips & tricks (12)
- Web Design tips & tricks (33)
- HTML, Javascript tips tricks (68)
- Web Promotion tips & tricks (8)
- Graphics tips & tricks (20)
