首頁  >  文章  >  web前端  >  css實現橫向與垂直進度條效果的方法

css實現橫向與垂直進度條效果的方法

王林
王林轉載
2020-05-19 09:08:253547瀏覽

css實現橫向與垂直進度條效果的方法

1、橫向進度條的實作程式碼

<html>
<head>
<title>横向进度条</title>
<style type="text/css">   
    .loadbar
    {
         width:200px;
         height:25px;
         background-color:#fff;
         border:1px solid #ccc;        
    }
    .bar
    {
        line-height:25px;        
        height:100%;
        display:block;        
        font-family:arial;
        font-size:12px;
        background-color:#bb9319;        
        color:#fff;
    }
</style>
</head>
<body> 
    <div class="loadbar">
      <strong class="bar" style=&#39;width:30%;&#39;>30%</strong>
    </div>
</body>
</html>

效果如下:

css實現橫向與垂直進度條效果的方法

二、豎向進度條的實作代碼

<html>
<head>
<title>竖向进度条</title>
<style type="text/css">   
    .loadbar
    {
         width:25px;
         height:200px;
         background-color:#fff;
         border:1px solid #ccc;
         position:relative; 
    }
    .bar
    {
        width:100%;
        display:block;        
        font-family:arial;
        font-size:12px; 
        background-color:#bb9319;
        color:#fff;       
        position:absolute;
        bottom:0;        
    }
</style>
</head>
<body> 
    <div class="loadbar">
      <strong class="bar" style=&#39;height:30%;&#39;>30%</strong>
    </div>
</body>
</html>

實作結果:

css實現橫向與垂直進度條效果的方法

推薦教學:CSS入門基礎教學

以上是css實現橫向與垂直進度條效果的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:jb51.net。如有侵權,請聯絡admin@php.cn刪除