Sha*_*aoz 8 html css webkit google-chrome legend
我到处都看,但无济于事.
我得到了<legend>一个表单,除了Chrome之外,它在每个浏览器中显示我想要的内容.它就像它位于fieldset之外,或者就像它位于下一个元素之上.这非常烦人.我甚至不能把利润放在上面.
为什么它以这种方式显示?
有解决方法吗?
HTML:
<fieldset class="col-12-box-bottom add-extras">
<legend class="plus">Add Promotion Code</legend>
<ul id="promo-fields">
<li><input class="field-small" type="text" /></li>
<li><button class="but-sec" type="submit">Apply</button></li>
</ul>
</fieldset>
Run Code Online (Sandbox Code Playgroud)
CSS:
.add-extras legend{
width: 260px;
height: 0px;
border: 1px solid red;
display: block;
margin-top: 10px;
}
.add-extras fieldset{
position: relative;
}
.add-extras ul{
padding: 0 0 20px 0 !important;
overflow: hidden;
}
.add-extras li{
list-style-type: none;
float: left;
margin: 0 18px 0 0;
}
.add-extras li:last-child a{
color: #afafaf;
display: block;
margin: 27px 0px 0 0;
}
fieldset.add-extras{
margin: 0px 0 23px 0;
}
.add-extras label{
float: none;
display: block;
text-align: left;
width: 110px;
font-weight: bold;
margin: 0 0 5px 0;
}
Run Code Online (Sandbox Code Playgroud)
Ste*_*ler 14
这是legendwebkit浏览器中元素的已知问题.图例元素本身没有干净的变通方法,但您可以将边距添加到图例后面的第一个元素.
此外,您必须明确设置-webkit-margin-collapse: separate该元素才能使其正常工作.试试这个:
legend + * {
-webkit-margin-top-collapse: separate;
margin-top: 10px;
}
Run Code Online (Sandbox Code Playgroud)
(在这里找到答案:无法在Safari和Chrome(WebKit)中将`margin`添加到`<legend>`元素)
| 归档时间: |
|
| 查看次数: |
10876 次 |
| 最近记录: |