在CSS选择器中,逗号是什么意思? [英] What do commas mean in CSS selectors?

查看:206
本文介绍了在CSS选择器中,逗号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我有

#A .B,
#A .C { some styles }

这是否意味着B类没有样式定义?

Does it mean that class B has no style definitions?

推荐答案

这意味着 #A .B #A .C 共享相同的声明块。

It means both #A .B and #A .C share the same declaration block.

逗号表示将该块中的声明应用于这两个选择器,而逗号后面的换行符' t是什么特别的;它只是纯空格用于提高样式表的可读性。

The comma says to apply the declarations in that block to both of those selectors, while the line break after the comma doesn't mean anything special; it's just pure whitespace used to improve readability of the stylesheet.

这篇关于在CSS选择器中,逗号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆