搜尋

首頁  >  問答  >  主體

如何使用CSS建立帶有多個點的垂直線?

我正在嘗試使用包含多個點的 CSS 來建立一條垂直線。但是,我不太確定該怎麼做。

有人可以幫我解決這個問題嗎?

我想在這裡創建一個像這樣的東西。

P粉001206492P粉001206492362 天前456

全部回覆(2)我來回復

  • P粉376738875

    P粉3767388752024-02-22 09:50:25

    您可以在此處使用 SVG 圖像。

    
      
        
          
          
        
      
      
      
    

    回覆
    0
  • P粉132730839

    P粉1327308392024-02-22 09:04:39

    我希望下面的程式碼能幫助您解決問題。如果您需要更多,您可以使用 垂直精靈 進行 Google 搜尋並取得以下附加程式碼:

    ul {
      list-style: none;
      margin: 0;
      padding: 0;
      position: relative;
    }
    
    ul:before {
      content: "";
      display: inline-block;
      width: 2px;
      background: red;
      position: absolute;
      left: 3px;
      top: 5px;
      height: calc(100% - 10px);
    }
    
    ul li {
      position: relative;
      padding-left: 15px;
      margin-bottom: 15px;
    }
    
    ul li:before {
      content: "";
      display: inline-block;
      width: 8px;
      height: 8px;
      background: red;
      position: absolute;
      left: 0;
      top: 5px;
      border-radius: 10px;
    }
    • item 1
    • item 2
    • item 3
    • item 4
    • item 5

    回覆
    0
  • 取消回覆