Meja asas


Elemen <table> Foundation digayakan dengan jalur zebra kelabu dan mengandungi empat sempadan:

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 style="padding:20px;">

<h2>基本表格</h2>
<p>Foundation 的 table 元素样式为灰色斑马条纹且包含四个边框:</p>
<table>
  <thead>
    <tr>
      <th>Firstname</th>
      <th>Lastname</th>
      <th>Email</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John</td>
      <td>Doe</td>
      <td>john@example.com</td>
    </tr>
    <tr>
      <td>Mary</td>
      <td>Moe</td>
      <td>mary@example.com</td>
    </tr>
    <tr>
      <td>July</td>
      <td>Dooley</td>
      <td>july@example.com</td>
    </tr>
  </tbody>
</table>

</body>
</html>

Running Instance»

Klik butang "Jalankan Contoh" untuk melihat contoh dalam talian


Jadual responsif

Gunakan CSS untuk menjadikan jadual menyokong reka bentuk responsif: tambah di luar jadual <div> Elemen dengan gaya overflow-x:hidden:

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 style="padding:20px;">

<h2>响应式表格</h2>
<p>在 div 元素上添加 overflow-x:auto 样式,让它支持响应式。</p>
<p>重置浏览器窗口查看效果 (如果空间不足会出现垂直滚动条)。</p>
<div class="responsive">
<table>
  <thead>
    <tr>
      <th>Firstname</th>
      <th>Lastname</th>
      <th>Email</th>
      <th>City</th>
      <th>Age</th>
      <th>Country</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John</td>
      <td>Doe</td>
      <td>john@example.com</td>
      <td>New York</td>
      <td>35</td>
      <td>USA</td>
    </tr>
    <tr>
      <td>Mary</td>
      <td>Moe</td>
      <td>mary@example.com</td>
      <td>Chicago</td>
      <td>51</td>
      <td>USA</td>
    </tr>
    <tr>
      <td>July</td>
      <td>Dooley</td>
      <td>july@example.com</td>
      <td>San Francisco</td>
      <td>38</td>
      <td>USA</td>
    </tr>
  </tbody>
</table>
</div>

</body>
</html>

Run Instance»

Klik "Run Instance butang " Lihat contoh dalam talian