HTML and CSS Reference
In-Depth Information
5.2.6.7. Align and <center> are deprecated
The HTML 4 and XHTML standards have deprecated the
align
attribute
for all tags, including
<img>
, in deference to stylesheets. They've de-
precated
<center>
, too. Nonetheless, the attribute and tag are very pop-
ular among HTML authors and remain well supported by the popular
browsers. So, while we do expect that someday both
align
and
<center>
will disappear, it won't be anytime soon. Just don't say we didn't warn
you.
What if you don't want to use
align
or
<center>
? Some authors and
many of the WYSIWYG editors use HTML/XHTML tables to align content.
That's one way, albeit involved (see
Chapter 10
). The World Wide
Web Consortium (W3C) wants you to use styles. For example, use the
margin-left
style to indent the image from the left side of the display.
You can read lots more about Cascading Style Sheets (CSS) in
Chapter
5.2.6.8. The border attribute
Browsers normally render images that also are hyperlinks (i.e., images
included in an
<a>
tag) with a 2-pixel-wide colored border, indicating
to the reader that he can select the image to visit the associated doc-
ument. Use the
border
attribute and a pixel-width thickness value to
remove (
border=0
) or widen that image border. Be aware that this
attribute, too, is deprecated in HTML 4 and XHTML, in deference to
stylesheets, but continues to be well supported by the popular browsers.
Figure 5-17
shows you the thick and thin of image borders, as rendered
by Internet Explorer from the following XHTML source: