Foundation 圖示
Foundation 提供了 283 個圖標,你可以使用css來定義它的樣式尺寸。
圖示可用於文本,按鈕,工具條,導航欄,表單等。
圖示語法
建立圖示語法格式如下:
<i class="fi-name"></i>
name 部分替換為圖示的名字。
要使用圖示我們需要在<head> 部分加入圖示的樣式檔案:
<link rel="stylesheet" href="../style/css/ foundation-icons.css">
Icon 實例
以下示範了使用圖示的實例:
實例
#
<!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"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-icons/foundation-icons.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>Cloud icon: <i class="fi-cloud"></i></p> <p>Cloud icon as a link: <a href="#"><i class="fi-cloud"></i></a> </p> <p>Styled Cloud icon: <i class="fi-cloud" style="font-size:35px;color:red;"></i></p> <p>Home icon: <i class="fi-home"></i></p> <p>Home icon on a button: <button type="button" class="button"> <i class="fi-home"></i> Home </button> </p> <p>Home icon on a green button: <button type="button" class="button success"> <i class="fi-home"></i> Home </button> </p> <p>Home icon on a large, light blue link button: <a href="#" class="button info large"> <i class="fi-home"></i> Home </a> </p> </div> </body> </html>
運行實例»
點擊"運行實例"按鈕查看線上實例
工具列圖示
我們可以使用.icon-bar
類別來建立一個指定數量的工具列圖示:
#實例
<!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"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-icons/foundation-icons.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> <h2>Icon Bar</h2> <div class="icon-bar five-up"> <a href="#" class="item"> <i class="fi-home"></i> </a> <a href="#" class="item"> <i class="fi-share"></i> </a> <a href="#" class="item"> <i class="fi-info"></i> </a> <a href="#" class="item"> <i class="fi-mail"></i> </a> <a href="#" class="item"> <i class="fi-magnifying-glass"></i> </a> </div> </body> </html>
運行實例»
點擊"運行實例" 按鈕查看線上實例
圖示描述使用<label>
元素:
實例
<!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"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-icons/foundation-icons.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> <h2>图标工具栏</h2> <div class="icon-bar five-up"> <a href="#" class="item"> <i class="fi-home"></i> <label>Home</label> </a> <a href="#" class="item"> <i class="fi-share"></i> <label>Share</label> </a> <a href="#" class="item"> <i class="fi-info"></i> <label>Info</label> </a> <a href="#" class="item"> <i class="fi-mail"></i> <label>Mail</label> </a> <a href="#" class="item"> <i class="fi-magnifying-glass"></i> <label>Search</label> </a> </div> </body> </html>
運行實例»
點擊"運行實例"按鈕查看線上實例
. disabled
類別可以讓圖示變成不可點擊狀態:
實例
#
<!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://cdn.static.runoob.com/libs/foundation/5.5.3/css/foundation.min.css"> <link rel="stylesheet" href="http://static.runoob.com/assets/foundation-icons/foundation-icons.css"> <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://cdn.static.runoob.com/libs/foundation/5.5.3/js/foundation.min.js"></script> <script src="http://cdn.static.runoob.com/libs/foundation/5.5.3/js/vendor/modernizr.js"></script> </head> <body> <h2>图标工具栏</h2> <div class="icon-bar five-up"> <a href="#" class="item"> <i class="fi-home"></i> </a> <a href="#" class="item disabled"> <i class="fi-share"></i> </a> <a href="#" class="item"> <i class="fi-info"></i> </a> <a href="#" class="item disabled"> <i class="fi-mail"></i> </a> <a href="#" class="item"> <i class="fi-magnifying-glass"></i> </a> </div> </body> </html>
執行實例»##點擊"運行實例" 按鈕查看線上實例
.vertical 類別用於建立一個垂直的工具列:
<!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">
<link rel="stylesheet" href="http://static.php.cn/assets/foundation-icons/foundation-icons.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>
<h2>图标工具栏</h2>
<div class="icon-bar vertical five-up">
<a href="#" class="item">
<i class="fi-home"></i>
</a>
<a href="#" class="item">
<i class="fi-share"></i>
</a>
<a href="#" class="item">
<i class="fi-info"></i>
</a>
<a href="#" class="item">
<i class="fi-mail"></i>
</a>
<a href="#" class="item">
<i class="fi-magnifying-glass"></i>
</a>
</div>
</body>
</html>
運行實例»##點擊"運行實例"按鈕查看線上實例Foundation 圖示參考手冊
更多關於圖示的內容,可以參考我們的Foundation 圖示手冊。