|
Several students have run into a problem when trying to use a background to create a left-hand color margin and tables to organize the material. This is a popular layout because it mimics a frameset while avoiding the problems posed by frames. The page may look something like this when the screen is full-sized: But when the screen is resized to be smaller, the tables collapse on the background so that it looks like this: |
|||||
|
A key to not having the table collapse is to use fixed pixels to define the width of your cells, rather than relative percentage. This means that the left hand cell needs to be something like <td width="125"> and the other cell needs to be something like <td width="450"> rather than defining them as 25% and 75%. However, even this will collapse when the screen gets very small. Remember also that the W3C recommends using relative widths whenever possible to facilitate accessibility. Here are samples of several attempts to deal with the problem:
One complex coding solution is illustrated at thehungersite.org.The pages have a left edge textured to look like paper with a list of topics, which contrasts with the plain white space where the main contents is written. When you resize the screen, the layout stays intact. If you view the source code, you will see that they do this by nesting two tables within an overall table. The overall containment table has only one row and two cells. Each cell contains a table. Because they use a <tr> and <td> for each link inside the left-hand table, it is easy to get lost trying to follow the code. However, it is basically structured like this (with content omitted): <html>
</div> <!--
End the div tag for this inset table --> <td> <!--
Start second td tag for overall table -->
</div> <!--
End that second div alignment tag --> </body> This is one solution that seems to work. There is a caution, however: If you nest too many tables within tables within tables the computer gets indigestion and slows down display. The Warning at Webmonkey points out that nesting tables slows display and suggests that if you have to nest more than two deep, you should rethink your design. If anyone has other solutions, please send it to the ListServ.
|
Copyright by Diane Wang, 1999