IE 在 Fieldset 中发出最小边距顶部图例
IE 遇到一些字段集问题,如图所示,IE 甚至 IE9 都没有得到 margin-top: -26px;
有人如何知道修复方法吗?
fieldset{
border: 1px solid #CCC;
border-top-color: #AAA;
border-left-color: #AAA;
background: #EEE;
margin: 35px 0;
padding: 10px;
}
legend {
border: 1px solid #AAAAAA;
border-bottom: none;
padding: 5px 10px;
margin-left: -11px;
margin-top: -26px;
}
图片: https://i.sstatic.net/oVhb2.png
编辑:Google chrome 有同样的问题
Got some IE issue with fieldsets, as you can see in the image is that IE even IE9 doesn't get the margin-top: -26px;
Someone how knows the fix?
fieldset{
border: 1px solid #CCC;
border-top-color: #AAA;
border-left-color: #AAA;
background: #EEE;
margin: 35px 0;
padding: 10px;
}
legend {
border: 1px solid #AAAAAA;
border-bottom: none;
padding: 5px 10px;
margin-left: -11px;
margin-top: -26px;
}
image: https://i.sstatic.net/oVhb2.png
edit: Google chrome has the same issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
众所周知,字段集和图例很难在不同的浏览器中以相同的方式设置样式。你真的应该根据他们的局限性来设计,而不是根据你想要的设计。话虽如此...如果您仍然固执并想要做错误的事情,您应该在您想要的
图例
中放置一个元素风格。像这样的东西(参见 Fiddle)将适用于 Chrome 和 IE(注意:它不会 适合 Firefox)。有几点需要注意...
Fieldsets and legends are notoriously hard to style the same way across different browsers. You should really style to their limitations and not style to what you want. With that said... if you're still stubborn and want to do the wrong thing you should put an element within the
legend
that you style. Something like this (see Fiddle) will work for Chrome and IE (Note: it will not look right for Firefox).A couple things to note...
添加作品
为我
adding
works for me