Page 4 of 23PREVNEXT

HTML Tables II: Table and cell widths

The table has a width of 200 pixels. When the browser window is resized to be shorter than 200 pixels, part of the table is hidden and a horizontal scroll bar appears at the bottom.

This option is also known as a "fixed-width table" or a "pixel-based table." This option is good to use when you need precise control over how much space the table occupies on the page.

Click the Play button on the left to see an animated example of a fixed-width table.

Two things to notice in this animation:

  • The table width stays fixed at 200 pixels no matter how wide the browser window is.
  • If the browser window is resized to be shorter than 200 pixels, a scroll bar appears at the bottom of the window so that people can see the rest of it.

This second issue may seem minor in this animated example. However, the general principle applies in other situations. For example, let's say you made a table 1000 pixels wide. If somebody had a screen resolution of 800x600 (800 pixels wide and 600 tall), then they would have to scroll to see the remaining 200 pixels of the table.

Page 4 of 23PREVNEXT