I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using:
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#container {
min-height: 100%;
width: 100%;
}
And I place something like this in the page code:
<table id="container">
<tr>
<td>
...
This works for Opera 9, but not for Firefox 2 or Internet Explorer 7. Is there a simple way to make this solution work for all popular browsers?
(Adding id="container"
to td
doesn't help.)
On the Guides page you don't have the width=100%, and on the index. html page (your front page) you don't have it specified either, but all the text (the latest news) on your page automatically stretches the table to its full width. You have to add a table width tag. That should fix it.
To make an HTML table tit the screen: Set the width to 100%, so that your code will look like this: <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>My html table is set to fit the screen</td> </tr> ...
<html style="height: 100%;"> <body style="height: 100%;"> <table style="height: 100%;"> ... in order to force all parents of the table element to expand over the available vertical space (which will eliminate the need to use absolute positioning).
For example, pressing the Windows key and left arrow key resizes the window to fit the left half of the screen. Pressing the Windows key and the right arrow key resizes the window to fit the right half of the screen.
Try using this:
html, body {
height: 100%;
}
So besides making the table's height to 100%, you also should have to make sure that the html'd and body's height are also 100%, so it will stretch properly.
Just use the height
property instead of the min-height
property when setting #container
. Once the data gets too big, the table will automatically grow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With