div:first-child  表示第一个div,代码如下

  

<html>
<head>
<title></title>
</head>
    <style>
        *{
            margin:0;
            padding:0;
        }
        .show>div{
            width:100px;
            height:100px;
        }
        .show>div:first-child{
            color:red;
        }
    
    </style>
<body>
    <div class="show">
        <div>第一个div</div>    
        <div>第二个div</div>
        <div>第三个div</div>
        <div>第四个div</div>
    </div>
</body>
</html>
View Code

相关文章:

  • 2021-06-14
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-07-16
猜你喜欢
  • 2021-11-20
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-12-06
  • 2021-12-06
相关资源
相似解决方案