利用flex关于边线自适应(利用flex)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>

    <style>
      .box {
        display: flex;
        width: 80%;
        align-items: center;

        margin: 0 auto;
      }

      .line {
        border-bottom: 1px solid blue;
        flex: 1;
       
      }

      .text {
        padding: 0 12px;
        font-weight: 700;
        font-size: 14px;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="line"></div>
      <div class="text">优惠信息</div>
      <div class="line"></div>
    </div>
  </body>
</html>

 

 

关于flex:1详解;https://blog.csdn.net/qq_40138556/article/details/103967529

 

posted @ 2021-02-01 00:24  全情海洋  阅读(77)  评论(0编辑  收藏  举报