4 replies [Last post]
vegoo
Offline
newbie
Last seen: 18 years 39 weeks ago
Joined: 2003-04-22
Posts: 1
Points: 0

Hello, please could you help me, I am having a problem.
I have a web page layout which has in the middle a DIV with the following details:

.content 
{ 
color: #4179a8; 
line-height: 1.4em; 
margin: 5px 145px 5px 145px; 
min-width: 90px; 
padding: 5px 5px 5px 5px; 
border: 1px solid #000000; 
border-top: 1px solid #000000; 
background-color: #eeeeff; 
position: relative; 
width: auto; 
z-index: 3; 
} 

In the <div class="content"></div> tags, I want to place a table that will fill the width of the DIV.

In the HTML:

<table class='fitted'> 
<tr> 
<td> 
Hello 
</td> 
</tr> 
</table> 

In the CSS:

table.fitted 
{ 
width:100%; 
} 

When I try this, the table that is within the DIV expands to fill 100% of the screen width, I do not want this, I want the table to fill only the width of the DIV (which is always the width of the browser window minus a certain number of pixels. As people use their browsers at different widths, I need a way to force the table to only occupy the width of the DIV.

I hope you can help, many thanks.

blakems
blakems's picture
Offline
Enthusiast
UTah, USA
Last seen: 18 years 41 weeks ago
UTah, USA
Timezone: GMT-7
Joined: 2003-04-07
Posts: 60
Points: 0

TABLE of width 100% to fill a DIV

don't give any css properties to the table. Just leave the table without a width and it should figure it out.

-bMs-
http//www.blakems.com !important;

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

TABLE of width 100% to fill a DIV

Problem here is different browsers render unspecified tables differently. And they also render specified tables differently!

For example Moz1 makes tables as small as possible if you don't give a width. But if you give a decent width (100% say) earlier versions of IE will do what I think is described above.

Any way of removing the table itself? I've got a similar problem, am currently ignoring it Wink but also thinking of how I can change the site layout to remove the tables. Not easy, is all I can come up with!

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

dorobo
dorobo's picture
Offline
Regular
Last seen: 18 years 39 weeks ago
Timezone: GMT-5
Joined: 2003-04-22
Posts: 21
Points: 0

TABLE of width 100% to fill a DIV

try to change your content div's width from "auto" to a specific width in pixel, let's say 100px and see what happens.

I've come across this some time ago and apparently, div's or any filling container need a precise width or height to be relative upon ( does that make sense? damn language barrier heh )

teon2now
Offline
newbie
Last seen: 12 years 45 weeks ago
Joined: 2009-03-15
Posts: 1
Points: 0

For example Moz1 makes

For example Moz1 makes tables as small as possible if you don't give a width. But if you give a decent width (100% say) earlier versions of IE will do what I think is described above.
радиолюбитель транзистор Ford Mondeo kia sorento шпаргалки рефераты українські реферати курсові роботи seropol4s
Any way of removing the table itself? I've got a similar problem, am currently ignoring it Eye-wink but also thinking of how I can change the site layout to remove the tables. Not easy, is all I can come up with!