div CSS 选择器在 IE 中无法识别后,我重新编码我的 CSS 样式,例如: div#bodyMain div#paneLeft>div{/*styles here*/} -6ren">
gpt4 book ai didi

CSS 格[编号| ="subPane"]错误

转载 作者:行者123 更新时间:2023-11-27 22:40:24 28 4
gpt4 key购买 nike

在知道 parent>div CSS 选择器在 IE 中无法识别后,我重新编码我的 CSS 样式,例如:

div#bodyMain div#paneLeft>div{/*styles here*/}

为此:

div#bodyMain div#paneLeft div[id|="subPane"]{/*styles here*/}

这是我的 html 片段:

<div id="bodyMain">
<div id="paneLeft">
<div id="subPaneCategory">
<p id="subPaneTitle">Shop Item Categories</p>
<!--other html here -->
</div></div</div>

问题是我的/styles here/现在在 Mozilla 中不起作用。在 element[attribute|="value"] 的使用中有什么我需要知道的吗?谢谢

最佳答案

管道 (|=) 用于匹配带连字符的值。 IE 可能会忽略管道,而在 Mozilla 中,您的样式不再有效,因为它尊重管道,但这与您的标记不匹配(没有连字符)。

^= 运算符匹配“StartsWith”值,$= 匹配“EndsWith”。我很确定这些都不被 IE 识别。如果您需要跨浏览器支持,通常最安全的做法是:

  • ele
  • #id
  • .class
  • (空格)后代
  • 还有一些其他的限制,比如 :hover for a

差不多就这些了。谢谢 IE :)

关于CSS 格[编号| ="subPane"]错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/633204/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com