Aligning Images


Perhaps the more expected use of the align attribute is for aligning images with text. You can align an image in various ways to a single line in a paragraph. However, be careful with multiple images on the same linedifferent align options have different effects depending on which image is taller and which appears first.

Figure 5.34. You can align an image with the top, middle, or bottom of the line in which it appears.


To align an image with text:

1.

Type <img src="/books/2/62/1/html/2/image.location" where image.location indicates the location on the server of the image.

2.

Type align="direction" where direction is top, middle, or bottom (Figure 5.35).

Figure 5.35. Notice that the height of the image affects the line height of the entire line.


3.

Add other attributes as desired and then type the final />.

4.

Type the text with which you wish to align the image. (This text may also precede the image.)

Tips

  • The align attribute is deprecated. That means the W3C recommends you start using style sheets to control how elements are aligned on your page (see page 188).

  • Firefox and Internet Explorer don't treat the middle value the same way. Firefox aligns images with the middle of the line of text in which they appear; Explorer aligns images with the middle of the other images on the line.





HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net