English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Komplettes Verzeichnis der HTML-Tags

HTML "table width"-Eigenschaft

Die "table width"-Eigenschaft legt die Breite der Tabelle fest. Wenn die "width"-Eigenschaft nicht gesetzt ist, belegt die Tabelle den erforderlichen Raum für die Anzeige der Daten.

 HTML <table> Tag

Online-Beispiel

mit 300 Pixel breite HTML-Tabelle:

<table width="300" border="1">
  <tr>
    <th>Name</th>
    <th>Credits</th>
  </tr>
  <tr>
    <td>Zhang San</td>
    <td>90</td>
  </tr>
  <tr>
    <td>Li Si</td>
    <td>87</td>
  </tr>
</table>
Test see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the width attribute.

Definition and Usage

HTML5 The <table> width attribute is not supported. Please use CSS instead.

The width attribute specifies the width of the table.

If the width attribute is not set, the table will occupy the necessary space to display the table data.

Tip:For practical purposes, it is better not to specify the width, but to use CSS to apply width (width)

Syntax

<table width="pixels|%">

Attribute Value

ValueDescription
pixelsSet the width as pixels (example: width="50")。
%Set the width of the element as a percentage of the containing element (example: width="50%")。
 HTML <table> Tag