单选按钮在 IE7 中显示不正确,但在 Firefox 中显示正常?

发布于 2024-08-08 03:27:24 字数 250 浏览 4 评论 0原文

我有一个在 ie8 和 firefox 中运行良好的网站设置,但正如您在此处看到的:

替代文本

这是某些 css 或 png 透明度的问题吗?或者这只是 IE7 的问题。

提前致谢 :)

I have a site setup that is working fine in ie8 and firefox but as you can see here:

alt text

Is this an issue with some css or a png transparency? Or is this just something with IE7.

Thanks in advance :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦毁影碎の 2024-08-15 03:27:24

我不确定这是否是您遇到的现象,但看起来确实如此,因此:

单选按钮是 与其他标签一样。如果您有适用于所有输入标记的 CSS 规则,它们将与输入文本字段一起触发单选按钮(以及提交按钮和复选框等)。讽刺的是,IE 在这一点上尤其臭名昭著。

我倾向于使用以下类型的 HTML 片段:

<input type="radio" class="radio" ... />

然后像这样定义我的 CSS 规则:

input {
  // stuff for most input fields goes here, e.g.
  background-image:url(fancy.png);
}
input.radio {
  // reverting the rules I don't want applied, e.g.
  background-image:none;
}

虽然这并没有像人们认为应该使用的那样使用花哨的选择器,但它确实可以实现与旧版浏览器的出色兼容性,尤其是IE6(只要 Windows 2000 仍在使用,它就不会很快从互联网上消失)。

I'm not sure if this is the phenomenom you're experiencing, but it does strongly seem that way, so:

Radio buttons are <input> tags like any other. If you have a CSS rule that applies to all input tags, they'll fire for radio buttons (and submit buttons and checkboxes, et cetera) right along with input text fields. IE is particularly notorious about this one, ironically.

What I tend to do is use the following kind of HTML snippets:

<input type="radio" class="radio" ... />

And then define my CSS rules like this:

input {
  // stuff for most input fields goes here, e.g.
  background-image:url(fancy.png);
}
input.radio {
  // reverting the rules I don't want applied, e.g.
  background-image:none;
}

While that doesn't utilise fancy selectors like one could argue one ought to, it does makes for excellent compatability with legacy browsers, especially IE6 (which, as long as Windows 2000 is still in use, likely won't vanish from the internet all too soon).

葵雨 2024-08-15 03:27:24

对于任何有类似问题的人,解决这个问题的方法是添加到

background-image: none;

单选按钮的 css :) 希望有所帮助。

To anyone with a similar issue, the way around this was to add a

background-image: none;

To the css for the radio buttons :) Hope that helps.

ヅ她的身影、若隐若现 2024-08-15 03:27:24

我有 IE 9,并且我的 asp RadioButtonList 上有白色方形背景,如下所示:

<asp:RadioButtonList ID="RadioListSearchScope" runat="server" TextAlign="Right" >
<asp:ListItem Text="Include Thread & Inquiry Keywords" selected="true" Value="0"></asp:ListItem>
<asp:ListItem Text="Include Thread & Inquiry Title Text" Value="1"></asp:ListItem>
<asp:ListItem Text="Include Inquiry & Response Body Text" Value="2"></asp:ListItem>
<asp:ListItem Text="Search All the Above" Value="3"></asp:ListItem>

这在 Chrome、FireFox 等中看起来很好。这是通过在 RadioButtonList HTML 控件中不具有 CssClass 属性来解决的,记住这是作为 type=radio 的输入呈现的,然后将其添加到我的全局 CSS 样式表中

    input[type="checkbox"] {
        background: transparent;
        border: inherit;
        width: auto;
    }
    input[type="radio"] {
        background: transparent;
        border: inherit;
        width: auto;
    }

:治愈单选按钮!文本没问题,但小“按钮”有大约 20x20 像素的区域,无论如何都是白色的。这很好,直到背景不是白色为止!

我希望这有帮助!

I have IE 9 and had white square backgrounds on my asp RadioButtonList shown below:

<asp:RadioButtonList ID="RadioListSearchScope" runat="server" TextAlign="Right" >
<asp:ListItem Text="Include Thread & Inquiry Keywords" selected="true" Value="0"></asp:ListItem>
<asp:ListItem Text="Include Thread & Inquiry Title Text" Value="1"></asp:ListItem>
<asp:ListItem Text="Include Inquiry & Response Body Text" Value="2"></asp:ListItem>
<asp:ListItem Text="Search All the Above" Value="3"></asp:ListItem>

This looked fine in Chrome, FireFox etc. This was resolved by NOT having a CssClass attribute in the RadioButtonList HTML control, remember this is rendered as an input as a type=radio, and then adding this to my global CSS style sheet:

    input[type="checkbox"] {
        background: transparent;
        border: inherit;
        width: auto;
    }
    input[type="radio"] {
        background: transparent;
        border: inherit;
        width: auto;
    }

That seemed to heal the radio buttons! The text was O K - but the little 'button' had about a 20x20px area that was white no matter what. That is fine until the background is something other than white!

I hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文