站内搜索:
首页 >> 前端 >> 内容
css中两个类选择器之间有没有空格的区别

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

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中两个类选择器之间没有空格形成多类选择器,有空格形成后代选择器 。

  • 上一篇:小米前端实习面试题和一些面试经验浅谈
  • 下一篇:git中一些经常出现的错误的总结
  • 返回顶部