美文网首页
选中元素最后一行

选中元素最后一行

作者: 残_忆 | 来源:发表于2024-03-06 15:59 被阅读0次
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>
  <body>
    <div>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <p>111111111111111</p>
      <!-- <p>111111111111111</p>
      <p>111111111111111</p> -->
    </div>
  </body>
  <style lang="less" scoped>
    div{
      display: flex;
      flex-wrap: wrap;
    }
    p{
      width: 25%;
    }
    p:nth-child(4n+1):nth-last-child(-n+4),
    p:nth-child(4n+1):nth-last-child(-n+4)~p{
      color: red;
    }
  </style>
</html>

相关文章

网友评论

      本文标题:选中元素最后一行

      本文链接:https://www.haomeiwen.com/subject/xmvjzdtx.html