【问题标题】:css width and min-widthCSS 宽度和最小宽度
【发布时间】:2012-05-08 02:05:22
【问题描述】:

我将以下样式应用于表格

width: auto;
min-width: 98.5%;

当我在 chrome 浏览器中查看时,div 内的表格似乎只有包含 div 的大约 50% 的宽度。在 IE9 中,表格占据了整个宽度。在 Chrome 中,当我看到使用 F12 应用的样式时,两种样式都已应用且未交叉。

.containing > table {
position: relative;
left: 0;
margin-right: 0;
top: 0;
border: 1px solid #DDD;
width: auto;
min-width: 98.5%;
margin-bottom: 1em;
-webkit-border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-moz-border-radius-bottomright: 8px;
-moz-border-radius-bottomleft: 8px;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
}

html:

<div class="containing">
<table>

</table>
</div>

【问题讨论】:

  • 顺便说一句,如果你让你的例子更“最小”,它会有所帮助。例如,边界半径规则与问题无关。这让其他人更容易帮助您。

标签: css


【解决方案1】:

嘿,如果你想要边框,你应该定义边框半径,不要在表格中定义

我认为您在 div 中定义边框和边框半径是这样的

检查前生活。 http://jsfiddle.net/RfWWh/

并根据您的设计进行调整..

【讨论】: