SamB
SamB

Reputation: 3263

Full Page Width Table - HTML/CSS

This simply sets up a table and sets the width to 100% but the table does not stretch the width of the page.

Apparently it works in Firefox 4. I have been testing in Chrome 11

http://jsfiddle.net/CWNJM/

<html>
<head>
<style type="text/css">
    table, th, td
    {
        border: 1px solid black;
        border-collapse:collapse;
        width: 100%;
    }
</style>
</head>
<body >
<table align="center" >
    <tr><td align="center" valign="middle"><img width="100%" border='0' id="main_img" src="http://example.com/EiE99"/></td></tr>
</table>
</body>
</html>

Upvotes: 2

Views: 20058

Answers (1)

Victor Zamanian
Victor Zamanian

Reputation: 3190

It isn't working properly in Webkit (Google Chrome dev channel). The containing element needs at least one of these two:

margin: 0;
padding: 0;

Then it works. I used body { margin: 0; padding: 0; }

Edit: Seems like padding: 0; was what was needed in that particular "jsfiddle".

Upvotes: 2

Related Questions