|
|
| Register | Blogs | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
| Computing and Networks For discussion of personal computing and home networking issues. |
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Forum Member
Join Date: Dec 2002
Location: South Wales
Posts: 3,486
|
Setting a table's column width with CSS
I have two tables on a page, each with four columns. How can I set the columns to be a fixed width in my stylesheet?
Code:
<table class="calendar"> <tr> <td>16-21</td> <td>Tour Down Under</td> <td>Aus</td> <td>2.HC</td> </tr> <tr> <td>28-02</td> <td>Tour of Qatar</td> <td>Qat</td> <td>2.1</td> </tr> </table> Code:
table.calendar { width: 100%; }
table.calendar td { width: 10% 60% 15% 15%; }
|
|
|
|
| Most Popular on Digital Spy |
|
Please sign in or register to remove this message. |
|
|
#2 |
|
Forum Member
Join Date: Apr 2005
Location: Popincourt
Posts: 5,719
|
You need to set the width on each cell:
CSS: td.c1 { width: 10%; } td.c2 { width: 60%; } etc HTML: <td class="c1">16-21</td> <td class="c2">Tour Down Under</td> etc |
|
|
|
|
|
#3 |
|
Forum Member
Join Date: Dec 2002
Location: South Wales
Posts: 3,486
|
Thanks, that works. Seems kinda clunky, but oh well... Tables and CSS just don't mix well.
|
|
|
|
Entertainment:
Showbiz |
Music |
Television |
Movies |
Soaps |
Cult |
US TV |
Gaming |
Gay Spy
Reality TV:
Big Brother |
Strictly |
X Factor |
American Idol
Media:
Broadcasting |
Digital TV |
Tech Reviews
Elle |
Red |
Red Direct |
Psychologies |
SugarScape |
All About Soap |
Inside Soap
Copyright © 1999-2010 Digital Spy Limited. All Rights Reserved.
"Digital Spy" is the Registered Trade Mark of Digital Spy Limited.
Privacy Policy Terms and Conditions Advertise on Digital Spy