A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-table-width-attribute/ below:

HTML <table> width Attribute - GeeksforGeeks

HTML <table> width Attribute

Last Updated : 11 Jul, 2025

The HTML <table> element's width attribute specifies the width of the table. It can accept values in pixels or percentages. However, in HTML5, it is recommended to control table width using CSS instead.

Syntax
<table width="pixels | %">
Attribute Values

Note: The <table> width Attribute is not supported by HTML 5.

Example: In this example we defines a table with a border and width of 250 pixels. It contains headings for "Name", "Age", and "Branch" with one row of data.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML table width Attribute
    </title>
</head>

<body>
    <h1>GeeksforGeeks</h1>

    <h2>HTML table width Attribute</h2>

    <table border="1" width="250">
        <tr>
            <th>NAME</th>
            <th>AGE</th>
            <th>BRANCH</th>
        </tr>
        <tr>
            <td>BITTU</td>
            <td>22</td>
            <td>CSE</td>
        </tr>
    </table>
</body>

</html>

Output:

Supported Browsers

The browser supported by HTML <table> width Attribute are listed below:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4