Click to See Complete Forum and Search --> : 100 on td is not working


k0r54
04-02-2005, 01:16 PM
Hi,

How come with the code below it does not allow me to do 100% width.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>D-NET : - The very best in torrent downloads</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

<style type="text/css">
.cu_table {
border-collapse: collapse;
border: 2px solid black;
}

.cu_table td {
border: solid 1px black;
margin: 0;
padding: 3px;
font: small Verdana,sans-serif;
text-align: left;
vertical-align:top;
width:100%;
}

.cu_table th {
border: solid 1px black;
margin: 0;
padding: 3px;
background-color: #F5f7f7;
color: #21536A;
font: large Verdana,sans-serif;
font-weight: bold;
text-align: left;
}

.cu_thsml {
font-size:small;
}
</style>
</head>

<body>
<table class='cu_table'>
<tr>
<th colspan='2'><p>Sorry Error</p>
<p class='cu_thsml'>The following fields have not been completed correctly: -</p></th>
</tr>
<tr>
<td>
<ul>
<li><strong>First Name</strong> must be filled in.</li>
<li><strong>Last Name</strong> must be filled in.</li>
<li><strong>Display Name</strong> must be filled in.</li>
</ul>
</td>
</tr>
</table>
</body>
</html>

The thing is that if you add a another td into the second row it works fine?

because of the environment it is going into i can not set the table to 100%

Any ideas

Thanks
k0r54

ray326
04-02-2005, 02:45 PM
Any ideas
Dump the table and do it right?

k0r54
04-02-2005, 02:49 PM
The thing is i have done my other registration through tables.

my entire site is CSS apart from forms because i find to get what i want takes more code doing it via css than it is by tables.

If you can see why it is doin it then that would be gr8

ray326
04-02-2005, 03:01 PM
Dump the colspan. You've only got one column.

k0r54
04-02-2005, 03:03 PM
yeah unforuntaly its still the same

k0r54
04-02-2005, 04:26 PM
ok i have fixed it :d

all i did was put the col span on the th and then add a td and put the td border to 0

so its really there u just cant see it :)

Thanks
anyway
k0r54

gollux
04-02-2005, 04:30 PM
I take it that you intend the table to be 100% of the window area or container area, eh?

First of all, tables are only as big as their contents unless you put the size on them. Putting 100% on the <td> only means that it fills exactly the table that contains it. Do the following to the CSS:

.cu_table {
width: 100%;
border-collapse: collapse;
border: 2px solid black;
}

.cu_table td {
border: solid 1px black;
margin: 0;
padding: 3px;
font: small Verdana,sans-serif;
text-align: left;
vertical-align:top;
}

.cu_table th {
border: solid 1px black;
margin: 0;
padding: 3px;
background-color: #F5f7f7;
color: #21536A;
font: large Verdana,sans-serif;
font-weight: bold;
text-align: left;
}

.cu_thsml {
font-size:small;
}

And then knock off that useless colspan on the <th> tag as you have only a single cell in the row:

<tr>
<th><p>Sorry Error</p>
<p class='cu_thsml'>The following fields have not been completed correctly: -</p>
</th>
</tr>

k0r54
04-02-2005, 04:33 PM
as i mentioned, i could not do the table 100% as it caused problems with my environment which is why i done it with 100% on the td.

Thanks for the help though :)