User agents typically add a margin or padding to the body element of a document. This spacing isn't considered in the 100% calculation.
The typical solution is to remove this spacing by way of CSS:
Code:
body {
margin: 0;
padding: 0;
}
The table will now span the entire width. Just remember that other elements will now be flush against the viewport edges, so you may need to add a margin to them.
The start tag for your table element can now be simplifies somewhat to:
HTML Code:
<table border="1" width="100%" height="150" bgcolor="white" cellpadding="0">
Notice that I omitted the units in the height and cellpadding attributes. Unlike in CSS, HTML attributes assume pixels and never require units. However, almost all presentational units have been deprecated from HTML 4 in favour of style sheets.
Mike
Bookmarks