2011-06-21 52 views
0

http://jsfiddle.net/RpCTx/4/表格的CSS沒有正確應用?

表格列不會更改爲我指定的寬度。第二列是辦法縮小...

CSS:

body{ 
    font-size: 11px; 
    font-family: Calibri, Arial, Helvetica; 
} 
th { 
    border-bottom: 1px solid black; 
} 
.product_name, td { 
    width: 132px; 
} 
.description, td + td { 
    width: 290; 
} 
.quantity, td + td + td { 
    width: 30px; 
} 
.list_upfronts, td + td + td + td { 
    width: 77px; 
} 
.sales_price, td + td + td + td + td{ 
    width: 76px; 
} 

HTML:

<strong> 
    <u> 
     Starcraft, or something 
    </u> 
</strong> 

<table id="integration_and_data_services"> 
    <tr> 
     <th class="product_name"> 
      <b>Product Name</b> 
     </th> 
     <th class="description"> 
      <b>Description Information</b> 
     </th> 
     <th class="quantity"> 
      <b>QTY</b> 
     </th> 
     <th class="list_upfronts"> 
      <b>Upfronts</b> 
     </th> 
     <th class="sales_price"> 
      <b>Sales Price</b> 
     </th> 
    </tr> 
    <tr> 
     <td>Le Product name</td> 
     <td>Lots of text here about whatever the product is about. Just needs to wrap to multiple lines.... Probably should be about starcraft... whatever.</td> 
     <td>1.00</td> 
     <td>$4500.00</td> 
     <td>$4500.00</td> 
    </tr> 
</table> 

回答

3

你錯過了px了你width聲明的第2列:

.description, td + td { 
    width: 290px; 
} 

Demo

+0

zmog ............ – NullVoxPopuli

0

有一個在規則的錯誤:你缺少的「PX」

這是正確的:

.description, td + td { 
    width: 290px; 
} 
+1

我很高興互聯網存在...但這個錯誤是尷尬= \ – NullVoxPopuli

+0

**它發生:D(包括我在內的任何人) – OverLex