Quackit Logo

Got a MySpace Page?

Get "www.yourname.com" for your MySpace page. Learn how >>.

CSS Table Width

Print Version

Even if you use CSS exlusively to control your layouts, there may be times where an HTML table is still required (for example, to present tabular data). You can still use CSS to control the table width, borders, background and other properties.

To use CSS to control the table width, use the CSS width property. For example:

<table style="width:400px;">

If you're using an external style sheet for your css, table width can be declared there too - just call its class. For example:

HTML Code:

<table class="wide-table">

CSS Code:

table.wide-table { width:100%; }

You can also use the CSS table-layout property to make larger tables load faster.

For more on tables, check out the HTML Table Tutorial and the HTML Table Generator.

Enjoy this website?

  1. Link to this page (copy/paste into your own website or blog):
  2. Add this page to your favorite social bookmarks sites:
                     
  3. Add this page to your Favorites

Oh, and thank you for supporting Quackit!