Foundation 進度條
Foundation 進度列可以當作程式處理的程度來顯示:
我們可以在<div>
元素中使用. progress
類別來建立進度條,.meter
類別用於子元素(<span>)。我們可以在<span> 元素中設定進度百分比,如下所示:
#實例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>基本进度条</h2> <div class="progress"> <span class="meter" style="width:70%"></span> </div> </div> </body> </html>
執行實例»
#點擊"運行實例" 按鈕查看線上實例
進度條顏色
預設情況下,進度條顏色為藍色。不同顏色的類別為:.secondary
, .success
, 或.alert
:
實例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>进度条颜色</h2> <div class="progress"> <span class="meter" style="width:50%"></span> </div> <div class="progress secondary"> <span class="meter" style="width:50%"></span> </div> <div class="progress success"> <span class="meter" style="width:50%"></span> </div> <div class="progress alert"> <span class="meter" style="width:50%"></span> </div> </div> </body> </html>
運行實例»##點擊"運行實例"按鈕查看線上實例
圓角進度條
.radius 和
.round 類別用於為進度條添加圓角效果:
實例
運行實例»點擊"運行實例"按鈕查看線上實例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>圆角进度条</h2> <p>默认:</p> <div class="progress"> <span class="meter" style="width:50%"></span> </div> <p>圆角:</p> <div class="progress radius"> <span class="meter" style="width:50%"></span> </div> <p>圆形:</p> <div class="progress round"> <span class="meter" style="width:50%"></span> </div> </div> </body> </html>
運行實例»點擊"運行實例"按鈕查看線上實例
#進度條尺寸可以使用
.small -num 或
.large-num 來修改進度條的寬度,
num 是一個數字在1(8.33% ) 和12(default (100%)) 之間:
實例#
##點擊"運行實例" 按鈕查看線上實例進度條標籤
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>进度条尺寸</h2> <div class="progress large-1"> <span class="meter" style="width:50%"></span> </div> <div class="progress large-6"> <span class="meter" style="width:50%"></span> </div> <div class="progress large-9"> <span class="meter" style="width:50%"></span> </div> <div class="progress large-11"> <span class="meter" style="width:50%"></span> </div> <!-- Default width, if you remove .large-12 it will produce the same result --> <div class="progress large-12"> <span class="meter" style="width:50%"></span> </div> </div> </body> </html>##運行實例»
##點擊"運行實例" 按鈕查看線上實例進度條標籤
可以使用CSS 為進度條新增標籤。以下實例中我們加入了<span> 元素來顯示百分比:
實例
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> <style> .percentage { position: absolute; top: 50%; left: 50%; color: white; transform: translate(-50%, -50%); font-size: 12px; } </style> </head> <body> <div style="padding:20px;"> <h2>进度条标签</h2> <div class="progress"> <span class="meter" style="position:relative;width:75%"> <span class="percentage">75%</span> </span> </div> <div class="progress success"> <span class="meter" style="position:relative;width:50%"> <span class="percentage">50%</span> </span> </div> <div class="progress alert"> <span class="meter" style="position:relative;width:25%"> <span class="percentage">25%</span> </span> </div> </div> </body> </html>
#運行實例»
點擊"運行實例" 按鈕查看線上實例