|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Borders
Why did that happen? Remember in part one, before we set sizes for each cell? The same thing is happening here. So we add a width to the cells. Since we are going for a fixed width table, we can set all the widths in pixels.
This works well when the content of the table is large enough to always push the center cell outwards. But if there isn't enough content in the center cell, the table breaks in Netscape 4. IE and NN6 are willing to take your word that the cells on the sides should be that fixed pixel width, and expand the center column to fill the space. But NN4 figures you made a mistake and tries to distribute the space. We can fix this so it works in all the browsers. It's pretty simple. We just specify a width for the center column. But since the tables grows with the page, we can't set that width in pixels. We have to set it in percent. When we set the width of a table in percent, the percentage we specify is the percentage of the space the table is in. In this case the width of the page. But when we specify a percentage width for a cell we are talking about a percentage of the table. Since the table can be any size, large or small, but the corner images stay the same size, then the center column is actually changing what percentage of the table it contains every time the browser changes size. So we pick a percentage that is higher than the cell will probably ever be. We set the center column to 98% width. It shouldn't be 100% since there are other columns and the center column can never be 100% of the table width. But at 98% the browsers will just trim that number down to the size actually needed. We are basically saying "make it as wide as you can". Now no matter how wide the page gets, the table will always be 50% of it's width, and the border around the table looks the same in all major browsers. OK, now what about setting the height to a percentage? Lets say we want the table to expand to fill 50% of the height of the window.
Remember when I said That a table's size in percentage is based on what it is in? Well, this page is inside of another table. That table is set to 100% width and auto height. So it only grows taller to fit the content. The browsers don't see any extra room vertically, since when we set our table in percentages it refers to the percentage of what it's in. With the outer table set to auto height there's no room for our table to expand. But if we get rid of the outer table holding this page, and place our table on a blank page...... Go to the next page.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||