gpt4 book ai didi

css - 使用 CSS3 :not selector with IE - using Prototype

转载 作者:行者123 更新时间:2023-11-28 13:47:45 26 4
gpt4 key购买 nike

我需要为内容添加 CSS 样式 <div> ,它出现在我网站的所有页面上。但是,我不想在主页上使用新样式。

网站上的所有页面都有相似的结构:标题 <div>带导航栏,后跟内容 <div>与页面的内容。

我能想到的最好的办法是直接在主页的内容 div 下添加一个包装 div,就像这样......

<div id="content">
<div id="homepage_content">
....homepage content....

然后我可以将我的风格应用于整个内容<div>使用 :not选择器,因此 homepage_content 下的元素不包括在内。

这在 IE 中不起作用。我已经看到它的 jQuery 解决方法,但我们在我的网站上使用 Prototype。

有人对我有想法吗?

谢谢!

最佳答案

NOT 实际上是 not an option yet .

当然也有基于原型(prototype)的解决方法,但纯 CSS 解决方案可能更可取。

也许可以通过在其他对象周围添加另一个不可见的容器来解决这个问题?

<div id="content">
<div class="other_elements">
.... the other elements you want to style ....
</div>
<div id="homepage_content">
....homepage content....
</div>

然后处理其他对象,例如

#content .other_elements elementname {  ...... }

这是否可行,将取决于您的 CSS 结构。

关于css - 使用 CSS3 :not selector with IE - using Prototype,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4013518/

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