I have a table that sits within a div element. And I am trying to figure out how to make sure that the table's width will never extend beyond its parent div elements width.
I have my attempts below, which I encourage people to run because you will see the overflow issue clearly. How can I make sure that my table will not have a width greater than its parents divs width(which is 60% of the screen right now)?
My code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css" >
<!--
body {
font: 100%/1.4 Helvetica, Verdana, Arial sans-serif;
height: 100%;
margin: 0;
background-image: url(../Images/BGshadowEx.jpg);
background-repeat: repeat-x;
padding: 0;
color: #000;
padding-top: 5%;
font-size: 0.8em;
}
table.gallery { max-height: 400px; max-width: 400px; }
tr.galleryRow { max-height: 200px; max-width: 400px; }
td.picViewer { background-color: #9F3; overflow:scroll; max-height: 200px; max-width: 100px; }
.a { float: left; width: 20%; height: 100%; background-color: yellow; }
.b { float: left; width: 60%; height: 100%; background-color: blue;}
.c { float: left; width: 20%; height: 100%; background-color: green; }
-->
</style>
</head>
<body>
<div class="a">
<p> abcd </p>
</div>
<div class="b">
<p> abcd </p>
<table class="gallery">
<tr class="galleryRow">
<td class="picViewer"> aaaaaaaaaaaaaaaaaaa</td>
<td class="picViewer"> aaaaaaaaaaaaaaaaaaa</td>
<td class="picViewer"> aaaaaaaaaaaaaaaaaaa</td>
<td class="picViewer"> aaaaaaaaaaaaaaaaaaabbbbbbbbb</td>
</tr>
<tr class="galleryRow">
<td class="picViewer"> aaaaaaaaaaaaaaaaaaa</td>
<td class="picViewer"> aaaaaaaaaaaaaaaaaaa</td>
<td class="picViewer"> aaaaaaaaaaaaaaaaaaa</td>
<td class="picViewer"> aaaaaaaaaaaaaaaaaaabbbbbbbbbb</td>
</tr>
</table>
</div>
<div class="c">
<p> abcd </p>
</div>
</body>
</html>
This post has been edited by gretty: 03 February 2011 - 08:21 PM

New Topic/Question
Reply



MultiQuote





|