You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
选择器 p.important 解释为:“其 class 属性值为 important 的所有段落”。我更想把其解释为:“段落中类名(class属性)为important的元素”,或者“是段落,同时类名也是important的”。
多类选择器
<html><head><styletype="text/css">
.important {font-weight:bold;}
.warning {font-style:italic;}
.important.warning {background:red;}
</style></head><body><pclass="important">This paragraph is very important.</p><pclass="warning">This is a warning.</p><pclass="important warning">This paragraph is a very important warning.</p><p>This is a paragraph.</p><p>...</p></body></html>
在 HTML 中,一个标签可能有多个类名(class),每个类名之间用空格分隔。
通过把两个类选择器链接在一起,中间不加空格,仅可以选择同时包含这些类名的元素(类名的顺序不限)。
The text was updated successfully, but these errors were encountered:
没有空格的选择器有两种:
多类选择器
和结合元素选择器
。结合元素选择器
元素选择器可以结合类选择器来使用。
选择器 p.important 解释为:“其 class 属性值为 important 的所有段落”。我更想把其解释为:“段落中类名(class属性)为important的元素”,或者“是段落,同时类名也是important的”。
多类选择器
在 HTML 中,一个标签可能有多个类名(class),每个类名之间用空格分隔。
通过把两个类选择器链接在一起,中间不加空格,仅可以选择同时包含这些类名的元素(类名的顺序不限)。
The text was updated successfully, but these errors were encountered: