IE8和Firefox CSS选择器的区别?

发布于 2024-09-11 16:07:50 字数 411 浏览 0 评论 0原文

我的行为非常奇怪,似乎 IE8 没有正确处理 CSS 中的子选择器。请考虑以下情况:

<html>
  <head>
    <style>
    ul>li {font-style: italic}
   </style>
 </head>
 <body>
 <ul> <li>Hello </li> </ul>
 </body>
 </html>

这在 FF 上以斜体显示 Hello,但在 IE8 上则不然。如果将选择器更改为:

ul li {...}

它将在两个浏览器中显示斜体。

我哪里出错了?

I am getting really weird behavior, it seems like IE8 is not handling the child selector in CSS correctly. Consider the following:

<html>
  <head>
    <style>
    ul>li {font-style: italic}
   </style>
 </head>
 <body>
 <ul> <li>Hello </li> </ul>
 </body>
 </html>

This displays Hello in italics on FF, but not on IE8. If you change the selector to:

ul li {...}

It displays italic in both browsers.

Where am I going wrong?

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

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

发布评论

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

评论(1

假面具 2024-09-18 16:07:50

IE8 可以而且应该正确显示此 CSS 声明。检查您的兼容性视图设置并确认您没有在 IE7 模式下呈现页面。

IE8 can and should be displaying this CSS declaration correctly. Check your Compatibility View settings and confirm that you're not rendering the page in IE7 mode.

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