Intersection/union selector

Intersection selector

What is the intersection selector

Set attributes for the intersecting part of all selected labels

format
选择器1.选择器2{
    
    
属性:;
}
important point

1. The selector can use tag name/id name/class name.

2. There is no space between the selectors.

3. The intersection selector is only for understanding, in fact, you can directly use class/id to select, which is a bit redundant.

p.para1 {
    
    
    color: skyblue;
    text-align: center;
}
<p>我是段落</p>
<p>我是段落</p>
<p class="para1">我是段落</p>
<p class="para2">我是段落</p>

P tag selector and class selector group and.

effect:

[External link image transfer failed, the source site may have an anti-leech link mechanism, it is recommended to save the image and upload it directly (img-CH1xAyzE-1603272938244) (D:%5C%E6%95%99%E5%AD%A6%E8% A7%86%E5%B1%8F%5C%E5%89%8D%E7%AB%AF%5C%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0% 5CHTML+CSS%E7%AC%94%E8%AE%B0%5CCSS%E9%83%A8%E5%88%86%5Cimage-20201021171952276.png)]

Union selector

What is a union selector

Set attributes for all tags selected by the selector.

format
选择器1,选择器2{
    
    
属性:;
}
important point

1. Union selectors must be separated by commas.

2. Union selector is to write the tags/id/class with the same style together to save space.

Guess you like

Origin blog.csdn.net/LIUCHUANQI12345/article/details/109206118