我有一个div,其中包含包含输入表的表单。问题是,即使设置为220px(width:220px),div仍然使用宽度100%。DIV标记保持使用100%宽度
下面是截图http://i.imgur.com/YtEzzuI.jpg?1
这里是HTML去掉TRS和TDS
<div class="prikol_filter_div">
<form name="arrFilter_form" action="" method="get" class="prikol_filter_form">
<table class="data-table" cellspacing="0" cellpadding="2">
<thead>
<tr>
<td colspan="2" align="center">
<span class="prikol_filter_title">ПОДОБРАТЬ ПОДАРОК</span><hr>
</td>
</tr>
</thead>
<tbody>trs and tds</tbody>
<tfoot>trs and tds</tfoot>
</table>
</form>
</div>
和CSS
.prikol_filter_div {
margin: 0px;
display: block;
width: 220px;
}
.prikol_filter_form {
margin-bottom: 40px;
width: 222px;
background-color: #c3150d;
border-radius: 4px;
position: relative;
right: 17px;
}
没有施加其他的CSS样式。
你试过width:222px!important; ?? – jrenk
蓝色区域是'div's'width'橙色区域显示它是一个'block'元素,以便它后面的任何元素都将在新行中。如果这是不可取的,你可能想尝试浮动'div'。 –
刚刚尝试过。仍然是100%的宽度。 – Randomius