100 on td is not working

liunx

Guest
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 Download s</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
k0r54Any ideas
Dump the table and do it right?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 gr8Dump the colspan. You've only got one column.yeah unforuntaly its still the sameok 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
k0r54I 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>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 :)
 
Back
Top