However, the height of a table??”whether in pixels or a percentage??”is maintained only
as long as the contents do not require a larger size. A table??™s width takes precedence over its height, and a
table expands vertically before it expands horizontally.
The height attribute for the
tag has been removed in HTML 4.0 and higher by the
W3C, and its further use is highly discouraged. Although rendered in Dreamweaver, the attribute
no longer functions properly in most modern browsers, including Firefox, Safari, and Netscape 6.x.
NOTE NOTE
460
Adding Advanced Design Features Part III
Centering a Table in CSS
The align attribute in the tag is deprecated in HTML 4.0, which means a newer, preferred
method of achieving the same effect is available. In this case, Cascading Style Sheets (CSS), covered in
Chapter 7, provide the preferred method of setting an object??™s alignment. To center a table using CSS, you
need two CSS rules: one for the table itself and one for a surrounding the table. If, for example, the
class of the div is centerDiv, the CSS rules look like this:
.centerDiv {
text-align: center;
}
.centerDiv table {
margin-right: auto;
margin-left: auto;
text-align: left;
}
Without the text-align: left attribute in the .
Pages:
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878