4 replies [Last post]
Luffy
Offline
newbie
Last seen: 13 years 4 weeks ago
Timezone: GMT-5
Joined: 2007-08-22
Posts: 3
Points: 0

Hi,

I want to use table-layout:fixed for obvious reasons. But I don't know how to specify the size for some columns/cells.

Here's a sample:

<?xml version="1.0" encoding="UTF-8"?>

I Hate Web Browsers, HTML & CSS, but Javascript is nice!

.center {text-align: center;}
#hateTable {float: left; table-layout: fixed; width: 734px; border-collapse: collapse;}
#hateTable {font-size: 11px; font-family: verdana; background-color: #332733; color: white;}
#hateTable thead {font-weight: bold; background-color: #493c49;}
#hateTable th {border: 1px solid #ba9db4; padding: 4px 8px;}
#hateTable td {border: 1px solid #ba9db4; overflow: hidden; white-space: nowrap;}
#hateTable #head1 {width: 400px; text-align: left;}
#hateTable #head2 {width: 70px;}
#hateTable #head3 {width: 8px;}
#hateTable .col2 a {display: block; text-decoration: none; margin: 1px; padding: 4px 8px 5px 8px; color: white;}
#hateTable .col2 a:hover {background-color: #5fe24c; color: black;}
#hateTable img {border: 0; width: 16px; height: 16px; margin: 0; padding: 0;}
#hateTable .col1 {width: 40px;}
#hateTable .col2 {width: 350px;}
#hateTable td.col1 {width: 40px;}
#hateTable td.col2 {width: 350px;}
.col1 {width: 40px;}
.col2 {width: 350px;}

Col 1-2
Col 3
&nbsp


I Despise IE
HATE
&nbsp


Firefox is CRAP too
HATE
&nbsp

How can I set the size for .col1 and .col2 ? If it's not possible, then [email protected]#$%^&*

Thanks for any help!

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

A td isn't a column so those

You can control column widths if you make use of the 'col' & 'colgroup' tags.

http://www.w3.org/TR/html4/struct/tables.html#h-11.2.4.4

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Luffy
Offline
newbie
Last seen: 13 years 4 weeks ago
Timezone: GMT-5
Joined: 2007-08-22
Posts: 3
Points: 0

I know that td are not

I know that td are not column. But I didn't knew how to specify column width, and without table-layout: fixed, the code would work. A bit weird that inconsistency, anyway.

Big thanks for the help, very appreciated :thumbsup:

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 26 weeks 5 days ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Does using colgroup sort

Does using colgroup sort your problems?

And the XML prolog throws IE into Quirks Mode.

Verschwindende wrote:
  • CSS doesn't make pies

Luffy
Offline
newbie
Last seen: 13 years 4 weeks ago
Timezone: GMT-5
Joined: 2007-08-22
Posts: 3
Points: 0

Yeah, it did. It's a much

Yeah, it did. It's a much more convenient way to specify column width.
I also found out about the xml prolog and IE6.
Thanks for the reply.