CSS中的“>”是什么意思? [重复]

前端之家收集整理的这篇文章主要介绍了CSS中的“>”是什么意思? [重复]前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Possible Duplicate:
07000

>是什么CSS中的符号意味着什么我在我的wordpress博客主题中注意到它并想知道它在做什么。

#access li:hover > a,#access ul ul :hover > a,#access a:focus {
    background: #efefef;
}
#access li:hover > a,#access a:focus {
    background: #f9f9f9; /* Show a solid color for older browsers */
    background: -moz-linear-gradient(#f9f9f9,#e5e5e5);
    background: -o-linear-gradient(#f9f9f9,#e5e5e5);
    background: -webkit-gradient(linear,0% 0%,0% 100%,from(#f9f9f9),to(#e5e5e5)); /* Older webkit Syntax */
    background: -webkit-linear-gradient(#f9f9f9,#e5e5e5);
    color: #373737;
}
#access ul li:hover > ul {
    display: block;
}

解决方法

例如,它意味着只有“第一个嵌套”元素将被定位(“子”元素)
<div id="a">
       <div id="b">
         <div id="c">
       </div>
      </div>
    </div>

如果你写

#a div{
 background: red;
}

然后#b和#c都是红色的,但是如果你使用>喜欢

#a > div{
 background: red;
}

然后只有#b会变红,而#c则不会。

原文链接:https://www.f2er.com/css/217956.html

猜你在找的CSS相关文章