为什么在css中使用空格分隔事物

2022-01-10 00:00:00 css-selectors css

这是我不理解的 wordpress 样式表中的一些内容:

Here is something in a wordpress stylesheet that I don't understand:

blockquote cite,
blockquote em,
blockquote i {
font-style: normal;
}

blockquote 和 cite 之间的空格有什么作用?我知道如果它们用逗号分隔,那么 blockquote 和 cite 都会有 "font-style: normal;"现在它们用空格分隔,这是否意味着如果将块引用标签嵌入到引用标签中,它将得到font-style: normal;"?

what does the space between blockquote and cite do? I understand if they are separated by a comma, then both blockquote and cite will have "font-style: normal;" now they are separated by space, does this mean if a blockquote tag is embedded into a cite tag it will get "font-style: normal;"?

谢谢.

推荐答案

空间被称为 后代组合器.blockquote cite 选择 blockquote 元素内的任何 cite 元素.blockquote emblockquote i 也是如此.

The space is known as the descendant combinator. blockquote cite selects any cite element within a blockquote element. Likewise for blockquote em and blockquote i.

换句话说,这不是如果将块引用标签嵌入到引用标签中",而是相反(此外,您不能将 blockquotes 放在 cites 放在首位).

In other words, it's not "if a blockquote tag is embedded into a cite tag", it's the other way around (besides, you can't place blockquotes in cites in the first place).

如您所见,逗号将选择器序列分组到同一规则中.

As you note, commas group selector sequences into the same rule.

相关文章