首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >递减选择器用法

问递减选择器用法
EN

Stack Overflow用户
提问于 2017-08-06 22:21:28
回答 1查看 52关注 0票数 0

在这个问题上,我不能理解选择器的用法。

代码语言:javascript
复制
.fc > * {
    margin: 10px;
    padding: 20px;
    background-color: lightgray;
    border-radius: 10px;
}

那么.fc > *是什么意思呢?因为我真的不能“完全”理解这个。

HTML部件

代码语言:javascript
复制
<body>
<div class="fc">
    <header>Swanns Way - Overture</header>
    <aside>For a long time I used to go to bed early. Sometimes, when I had put out my candle, my eyes would close so quickly that I had not even time to say &quot;I'm going to sleep.&quot;</aside>
    <main>And half an hour later the thought that it was time to go to sleep would awaken me; I would try to put away the book which, I imagined, was still in my hands, and to blow out the light; I had been thinking all the time, while I was asleep, of what I had just been reading, but my thoughts had run into a channel of their own, until I myself seemed actually to have become the subject of my book: a church, a quartet, the rivalry between François I and Charles V. </main>
    <section>This impression would persist for some moments after I was awake; it did not disturb my mind, but it lay like scales upon my eyes and prevented them from registering the fact that the candle was no longer burning. </section>
    <footer>by Marcel Proust</footer>
</div>

​

EN

回答 1

Stack Overflow用户

发布于 2017-08-07 05:07:37

在现代CSS中,没有后代选择器这样的东西。该术语在CSS2中使用,但被后代组合符取代。

后代组合符由两个选择器之间的空格字符表示。

您的示例中没有这样的示例。你有一个大于号的符号,那是一个子组合符。

给定:

代码语言:javascript
复制
<a>
    <b> 
         <c>
         </c>
    </b>
</a>

  • b是a的子项,c是b的子项。
  • b和c都是
  • 的后代c是

的孙子项(而不是子项

.fc是一个类选择器。*是通用选择器(它匹配所有内容)

所以选择器是作为fc类成员的元素的子元素的每个元素。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45532946

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档