您现在的位置:首页 >> 前端 >> 内容

css中两个类选择器之间有没有空格的区别

时间:2017/9/27 11:21:00 点击:

  核心提示:css中两个类选择器之间有没有空格的区别:!DOCTYPE htmlhtmlheadmeta charset=UTF-8title/titlestyle.p1.p2{width: 100px;heig...

css中两个类选择器之间有没有空格的区别:

<!DOCTYPE html>  
<html>  
    <head>  
        <meta charset="UTF-8">  
        <title></title>  
        <style>  
            .p1.p2{width: 100px;height: 100px;background: red;}/*多类选择器*/  
            .p1 .p2{width: 100px;height: 100px;background: yellow;}/*后代选择器*/  
        </style>  
    </head>  
    <body>  
        <p class="p1 p2"></p>  
        <p class="p1">  
            <p class="p2"></p>      
        </p>      
    </body>  
</html>  

css中两个类选择器之间有没有空格的区别

结论:css中两个类选择器之间没有空格形成多类选择器,有空格形成后代选择器 。

Tags:CS SS S中 中两 
作者:网络 来源:Night_Empe