Butang asas


Gaya Butang

Yayasan menyediakan 6 gaya butang. Kelas .button mencipta butang biru dengan padding. Kelas butang warna yang berbeza ialah: .secondary, .success, .info, .warning atau .alert:

Instance

<!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>
  <button type="button" class="button">Default</button>
  <button type="button" class="button secondary">Secondary</button>
  <button type="button" class="button success">Success</button>
  <button type="button" class="button info">Info</button>
  <button type="button" class="button warning">Warning</button>
  <button type="button" class="button alert">Alert</button>
</div>

</body>
</html>

Jalankan Instance»

Klik butang "Run Instance" untuk melihat contoh dalam talian

Kelas butang boleh digunakan dalam <a>, <button>, atau <input> Elemen:

Instance

<!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>
  <a href="#" class="button info" role="button">链接按钮</a>
  <button type="button" class="button info">按钮</button>
  <input type="button" class="button info" value="Input 按钮">
  <input type="submit" class="button info" value="Submit 按钮">
</div>

</body>
</html>

Run Instance»

Klik butang "Run Instance" untuk melihat contoh dalam talian

NoteMengapa menetapkan href tag a kepada # ?
Note为什么将 a 标签的 href 设置为 # ?

当我们不希望链接点击跳转并得到 "404" 页面时,我们可以将 a 标签的 href 设置为 #。

Apabila kita tidak mahu pautan klik dan dapatkan "404" halaman, kita boleh menetapkan href bagi teg kepada #.

Saiz butang

.largeKita boleh menggunakan kelas .small, .tiny atau

untuk menetapkan butang saiz:

Instance
<!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>
  <button type="button" class="button large">Large</button>
  <button type="button" class="button">Default</button>
  <button type="button" class="button small">Small</button>
  <button type="button" class="button tiny">Tiny</button>
</div>

</body>
</html>

Run Instance»

Klik butang "Run Instance" untuk melihat contoh dalam talian

Butang Bulat

.radiusAnda boleh menggunakan kelas .round dan

untuk menetapkan butang bulat:

Instance
<!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>
  <button type="button" class="button">Default Button</button>
  <button type="button" class="button radius">Radius Button</button>
  <button type="button" class="button round">Round Button</button>
</div>

</body>
</html>

Jalankan Instance»

Klik butang "Run Instance" untuk melihat contoh dalam talian

Butang sambungan

.expandboleh digunakan

Kelas untuk menetapkan lebar jalur butang kepada 100%:

Instance
<!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>
  <button type="button" class="button">Default</button>
  <button type="button" class="button expand">Expanded Button</button>
</div>

</body>
</html>

Run Instance »

Klik "Jalankan Instance" lihat contoh dalam talian

Lumpuhkan butang

.disabledAnda boleh menggunakan kelas

untuk menetapkan butang menjadi tidak boleh diklik:

Instance
<!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>
  <button type="button" class="button">Default Button</button>
  <button type="button" class="button disabled">Disabled Button</button>
</div>

</body>
</html>

Run instance»

Klik butang "Run instance" untuk melihat instance dalam talian
<🎜>