> For the complete documentation index, see [llms.txt](https://information9527.gitbook.io/html/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://information9527.gitbook.io/html/2.css/position/table.md).

# Table

**HTML `<table>` 元件**代表表格數據──換句話說，就是透過二維資料表來呈現資訊。

{% tabs %}
{% tab title="HTML" %}

```markup
<table>
    <thead>
        <tr>
            <th colspan="2">The table header</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>The table body</td>
            <td>with two columns</td>
        </tr>
    </tbody>
</table>

```

{% endtab %}

{% tab title="css" %}

```css
table,
td {
    border: 1px solid #333;
}

thead,
tfoot {
    background-color: #333;
    color: #fff;
}
```

{% endtab %}
{% endtabs %}

## 屬性

&#x20;**`align`**

&#x20;這個枚舉屬性會指示表格中的文字要如何對齊。可用值如下：

* left：意思是表格應該顯示在文件的左方。
* center：意思是表格應該顯示在文件的中間。
* right：意思是表格應該顯示在文件的右方。

&#x20;在 CSS 要得出類似效果，應該設定 [`margin-left`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left)與 [`margin-right`](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right)；如果要置中，則要把 [`margin` ](https://developer.mozilla.org/en-US/docs/Web/CSS/margin) 屬性設定為 `0 auto`。

## Sticky position
