fieldset - Internet Explorer中的虚线边框解决方法?

时间:2013-11-14 21:29:35

标签: html css internet-explorer internet-explorer-9 internet-explorer-10

IE(9/10 /其他?)似乎忽略了fieldset elemenets的边框宽度1,如果它有一个虚线边框。有人知道解决方法吗?

小提琴:http://jsfiddle.net/9hjys/

<!DOCTYPE html><html><head></head><body>

<fieldset style='border:1px dashed;'>
   <legend style="background:white;">test</legend>
   fieldset dashed border is more than 1px wide in IE (9/10 at least, 
   not sure about others)
</fieldset>

<fieldset style='border:1px solid;'>
   <legend>test</legend>
   solid border is all normal like.
</fieldset>

<br/>
<div style='border:1px dashed;display:inline-block;'>
   inline-block divs work normal
</div>

<br/><br/>

<div style='border:1px dashed;display:block;'>
   block divs work normal
</div>

</body></html>

http://i.stack.imgur.com/LOois.png

1 个答案:

答案 0 :(得分:1)

我在IE11中重新创建了这个问题。

当该图例父字段集周围有虚线或虚线边框时,图例标记似乎存在IE错误。

解决方案 - 将图例显示为内联:

<legend style="background:white; display: inline;">test</legend>

这消除了异常,但也会将图例的位置更改为字段集内部。这个位置可以通过其他方式改变,但这超出了这个问题的范围。

萨姆