简体   繁体   English

IE Fieldset背景颜色出血Bug

[英]The IE Fieldset Background Color Bleed Bug

Setup: 建立:

I have an HTML page with a fieldset element. 我有一个带有fieldset元素的HTML页面。 The background color of the fieldset element is different from the background of the page. fieldset元素的背景颜色与页面的背景不同。 The border of the fieldset has a slightly darker color that the background. fieldset的边框具有比背景稍暗的颜色。

Problem: 问题:

In Firefox only the area inside the border has the specified background color. 在Firefox中,只有边框内的区域具有指定的背景颜色。 In IE7 the background color flows over the area delimited by the border (only at the top). 在IE7中,背景颜色流过由边框分隔的区域(仅在顶部)。

Question: 题:

What can I do to make the background of the fieldset element stay within the area delimited by the border on IE7? 我该怎么做才能使fieldset元素的背景保持在IE7边框所界定的区域内?

see this article for how to fix this problem: 请参阅此文章以了解如何解决此问题:

http://www.communitymx.com/content/article.cfm?cid=DD9F3 http://www.communitymx.com/content/article.cfm?cid=DD9F3

In summary: " Since IE's problem seems to extend from the fact that the legend is a child of the fieldset, the way to fix the bug is to disassociate the legend with the fieldset. The legend element has to stay nested within the fieldset element, of course, for the (X)HTML to remain valid, but if we absolutely position it, it will be removed from the flow of the document and treated by elements outside of it — including its parent — as if it didn't exist. " 总结: “由于IE的问题似乎来自于图例是字段集的子节点,因此修复bug的方法是将图例与字段集解除关联。图例元素必须保持嵌套在fieldset元素中,当然,对于(X)HTML仍然有效,但是如果我们绝对定位它,它将从文档流中删除并由它之外的元素(包括其父元素)处理 - 就好像它不存在一样。 “

Have you reset your margins and padding? 你重置边距和填充?

EDIT: 编辑:

Actually, Matt Heerema apparently had a similar problem. 实际上,Matt Heerema显然也有类似的问题。 Which he successfully fixed . 成功修复了哪个。

" Getting Fieldset Backgrounds and Legends to Behave in IE ". 在IE中获得Fieldset背景和传说 ”。

我遇到了同样的问题,一个简单的解决方法是将fieldset包装到div并设置该div的背景颜色,而不是将其设置为fieldset标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM