css表列宽未设置

时间:2010-05-26 04:31:37

标签: css

我正在尝试将表格列的宽度设置为最小值。标题行(th)设置为white-space:nowrap以防止包装。现在所有列(包括td行)都设置为th的宽度。我试图通过在html中将其设置为
来扩展较小列的大小  <th style="width:200px;"> and <td style="width:200px;">,但没有效果。在firebug中,在样式部分中,宽度设置处于活动状态

element.style  {
width:200px;
}

仍然,计算的选项卡显示宽度小于200px。请参阅下面的详细信息。

th - 计算:

Text
font-family verdana,arial,helvetica,sans-serif
font-size   10px
font-weight bold
font-style  normal
color   #333333
text-transform  none
text-decoration none
letter-spacing  normal
word-spacing    0
line-height 17px
text-align  left
vertical-align  baseline
direction   ltr
Background
background-color    transparent
background-image    none
background-repeat   repeat
background-position 0 0
background-attachment   scroll
opacity 1
Box Model
width   152px
height  17px
top auto
right   auto
bottom  auto
left    auto
margin-top  0
margin-right    0
margin-bottom   0
margin-left 0
padding-top 0
padding-right   0
padding-bottom  0
padding-left    0
border-top-width    0
border-right-width  0
border-bottom-width 0
border-left-width   0
border-top-color    #333333
border-right-color  #333333
border-bottom-color #333333
border-left-color   #333333
border-top-style    none
border-right-style  none
border-bottom-style none
border-left-style   none
Layout
position    static
display block
visibility  visible
z-index auto
overflow-x  visible
overflow-y  visible
white-space nowrap
clip    auto
float   none
clear   none
-moz-box-sizing content-box
Other
cursor  pointer
list-style-image    none
list-style-position outside
list-style-type disc
marker-offset auto

和td - 计算:

Text
font-family verdana,arial,helvetica,sans-serif
font-size   11px
font-weight 400
font-style  normal
color   #222222
text-transform  none
text-decoration none
letter-spacing  normal
word-spacing    0
line-height 12px
text-align  left
vertical-align  top
direction   ltr
Background
background-color    transparent
background-image    none
background-repeat   repeat
background-position 0 0
background-attachment   scroll
opacity 1
Box Model
width   152px
height  48px
top auto
right   auto
bottom  auto
left    auto
margin-top  0
margin-right    0
margin-bottom   0
margin-left 0
padding-top 5px
padding-right   6px
padding-bottom  5px
padding-left    6px
border-top-width    0
border-right-width  1px
border-bottom-width 0
border-left-width   0
border-top-color    #222222
border-right-color  #222222
border-bottom-color #222222
border-left-color   #DDDDDD
border-top-style    none
border-right-style  none
border-bottom-style none
border-left-style   solid
Layout
position    static
display table-cell
visibility  visible
z-index auto
overflow-x  visible
overflow-y  visible
white-space normal
clip    auto
float   none
clear   none
-moz-box-sizing content-box
Other
cursor  auto
list-style-image    none
list-style-position outside
list-style-type disc
marker-offset   auto

任何帮助,非常感谢...谢谢

1 个答案:

答案 0 :(得分:2)

min-width:200px