代码之家  ›  专栏  ›  技术社区  ›  bsr

未设置CSS表列宽

css
  •  2
  • bsr  · 技术社区  · 15 年前

    我正在尝试将表列的宽度设置为最小值。标题行(th)被设置为空白: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 回复  |  直到 15 年前
        1
  •  2
  •   Amarghosh    15 年前

    min-width:200px