PDA

View Full Version : Set the width of table cells with CSS?



chris_bcn
07-11-2005, 10:24 PM
Hi,

I'd link to be able to set up a table that has a width of 500px, and the left column has a width of 200px and the right 300px (duh!). Can I set this up with css? It needs to be worked so that each time someone creates a new table the dimensions are always the same.

This is what I have so far

table {
border-collapse: collapse;
width: 100%;
margin: 0 0 .5em 0;
font:normal normal 90%/125% verdana, arial, sans-serif;
color:#000;
padding:3px;
}
table th {
padding: 3px 3px;
background: #E9DDC7;
font-weight: normal;
text-align: left;
color: #58493A;
border: 1px solid #DFD0B3;
}

table td {
text-align: left;
padding: 3px 3px;
border: 1px solid #DED3BF;
background: #FFF;
font:normal normal 85%/125% verdana, arial, sans-serif;
}
.row{
width:50%;
}
.box{
width:500px;
margin-bottom:10px;
margin-left:10px;
}

This seems to kind of work, but when a new table is created the dimension change depending on what content is placed in the cells. Also it means that the columns are of equal length, which I don't want.

I throw myself down onthe mercy of CSS gurus once more to help me out

Cheers