How to implement a layout like css layout

problem description

how do you implement such a layout when you encounter such a layout in your development?

clipboard.png

the environmental background of the problems and what methods you have tried

try to use postion to find some redundancy in css code. Is there any good way to ask for advice?

May.03,2021

Please Baidu css step bar keywords


try it with flex layout. Every day is a good module


A small demo,flex layout, each piece is independent, the number of up and down and the number of days if it is possible to wrap, you should add a non-wrapping constraint.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style type="text/css">
  *{padding:0;margin:auto;}
  ul{display:flex;align-items:center;justify-content:space-between;list-style:none;}
  li{width:33.33%;text-align:center;}
  .bar{width:100%;height:1px;margin:10px auto;background-color:-sharpccc;position:relative;}
  .bar .icon{height:14px;width:14px;display:inline-block;border-radius:50%;background-color:-sharpccc;position:absolute;left:50%;top:0;margin-top:-7px;margin-left:-7px;}
  </style>
</head>
<body>
  <div>
    <ul>
      <li>
        <div class="num">+1</div>
        <div class="bar">
          <span class="icon"></span>
        </div>
        <div class="day">1</div>
      </li>
      <li>
        <div class="num">+1</div>
        <div class="bar">
          <span class="icon"></span>
        </div>
        <div class="day">1</div>
      </li>
      <li>
        <div class="num">+1</div>
        <div class="bar">
          <span class="icon"></span>
        </div>
        <div class="day">1</div>
      </li>
    </ul>
  </div>
</body>
</html>
Menu