Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法设置CSS表格宽度_Css - Fatal编程技术网

无法设置CSS表格宽度

无法设置CSS表格宽度,css,Css,两列,几行。 整张桌子的宽度似乎设置得很好。没有机会改变它。我所能做的就是移动行分隔符,使一列拉伸,而另一列展开 这是CSS文件 body { font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: #E6EAE9; } a { color: #c75f3e; } #mytable { wi

两列,几行。 整张桌子的宽度似乎设置得很好。没有机会改变它。我所能做的就是移动行分隔符,使一列拉伸,而另一列展开

这是CSS文件

    body {
    font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #4f6b72;
    background: #E6EAE9;
}

a {
    color: #c75f3e;
}

#mytable {
    width: 450px;
    padding: 0;
    margin: 0;
    height: 39px;
}

caption {
    padding: 0 0 5px 0;
    width: 489px;    
    font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    text-align: right;
}

th {
    font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #4f6b72;
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    border-top: 1px solid #C1DAD7;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: left;
    padding: 6px 6px 6px 12px;
    background: #CAE8EA url(images/bg_header.jpg)  no-repeat;
}

th.nobg {
    border-top: 0;
    border-left: 0;
    border-right: 1px solid #C1DAD7;
    background: none;
}

td {
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    background: #fff;
    padding: 6px 6px 6px 12px;
    color: #4f6b72;
}


td.alt {
    background: #F5FAFA;
    color: #797268;
}

th.spec {
    border-left: 1px solid #C1DAD7;
    border-top: 0;
    background: #fff url(images/bullet1.gif)  no-repeat;;
    font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}

th.specalt {
    border-left: 1px solid #C1DAD7;
    border-top: 0;
    background: #f5fafa url(images/bullet2.gif)  no-repeat;;
    font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #797268;
}
这是桌子

   <table id="mytable" cellspacing ="0">
    <caption>Table 1: Descriptions </caption>
    <tr>
      <th scope="col" abbr="Configurations" class="nobg" style="width: 47px">Configurations</th>
      <th scope="col" abbr="Dual 1.8GHz">Original Stack</th>
    </tr>
    <tr>
      <th scope="row" class="spec" style="width: 47px">Model</th>
      <td class="style1">3xPa</td>
    </tr>
    <tr>
      <th scope="row" class="specalt" style="width: 47px">Year</th>
      <td class="alt" style="width: 181px">1998/A</td>
    </tr>
    </table>

表1:说明
配置
原始堆栈
模型
3xPa
年
1998/A
我不确定是什么阻止我改变整个桌子的宽度。我尝试更改#mytable中的width属性,但它完全没有任何作用。我正在使用VS2010,aspx网络表单


有什么想法吗

更改css中的表格宽度对我在chrome上的工作很好

尝试删除标题的宽度,标题上的绝对宽度可能会诱使您认为表格大小没有改变

caption {
    padding: 0 0 5px 0;
    /*width: 489px;  Commented Out */
    font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    text-align: right;
}

在IE上也是如此,在我的机器上是7,8,9…工作…这些是你测试的版本吗?有更多的CSS和HTML参与吗?版本9是的,它缩短了第2行(之前的短行是第1行,但不是说它是相同的),一些奇怪的事情正在发生。现在,柱被拉伸,与前一个状态相比有一半。但奇怪的是,桌子现在固定在那个里了。。。即使从#mytable中移动宽度属性也不会扩展它。完成了!不得不重新启动VS.感谢您的耐心和解释。