我无法理解这个主题的后代选择器用法。
.fc > * {
margin: 10px;
padding: 20px;
background-color: lightgray;
border-radius: 10px;
}
那么.fc > *
意味着什么?因为我真的不能完全"明白这一点。
HTML部分
<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 "I'm going to sleep."</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>
答案 0 :(得分:0)
在现代CSS中,没有后代选择器这样的东西。该术语在CSS 2中使用,但已替换为后代组合器。
后代组合子由两个选择器之间的空格字符表示。
你的例子中没有一个。你有一个大于符号,这是一个儿童组合者。
假设:
<a>
<b>
<c>
</c>
</b>
</a>
.fc
是一个类选择器。 *
是通用选择器(匹配所有内容)
因此,选择器是作为fc类成员的元素子元素的每个元素。