如何使用原生CSS在DIV层中画一条线?

 效果图

代码

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>Document</title>
</head>
<style>
  .box {
    height: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid red;
    height: 50px;
  }

  .line1 {
    height: 1px;
    background-color: #0765a9;
    flex-grow: 0.1;
  }

  .line2 {
    height: 1px;
    background-color: #0765a9;
    flex-grow: 1;
  }
</style>

<body>
  <div class="box">
    <span class="line1"></span>
    <span class="text">
      <input type="checkbox" />驾驶员
    </span>
    <span class="line2"></span>
  </div>
</body>
<script>

</script>

</html>
发布了171 篇原创文章 · 获赞 499 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/qq_43258252/article/details/103295852