Hello, is there anyway that I can actually make my tables smaller? I tried putting in a value for the width for the td tags, but it didn't seem to do anything. Also I want the table to fit on one page, but changing the width of the table tag to 100% didn't do anything.

Recommended Answers

All 5 Replies

Hello, is there anyway that I can actually make my tables smaller? I tried putting in a value for the width for the td tags, but it didn't seem to do anything. Also I want the table to fit on one page, but changing the width of the table tag to 100% didn't do anything.

Have you tried placing the WIDTH inside the TABLE tag? Such as the following:

<table width="100%">
  </table>

conversely, you can also use CSS to control the width of your table, such as:

<table style="width:100%;">
  </table>

if you are doing table-based design, I would highly recommend that you stick with percentages when defining a width for any given table.

hope this helps.

/jp/

No, that's what I tried changing the width of the table tag to 100%, but the table still overflows, so I have to scroll horizontally to see all of it.

If your content won't fit, the table adds scrollbars instead of shrinking the content.

Your content won't fit.

Reduce the size of the content, either by reducing the amount of content, or by reducing its size (font-size styles, etc.).

How would I shrink individual table cells down? I have some that are obviously going farther horizontally than they need to be. I tried changing the % and width for them that they need to be, but it didn't effect them.

The table cell will take the width of the widest thing in that column. You can make it wider, but not narrower.

Tricks to shrink the widths of table cells:

- Reduce the font size.

- Use a narrow font (e.g. Arial Narrow).

- Stick a <br /> tag in the text to make it wrap to a new line. This trades width for height.

- Replace a long word with a shorter one.

- reduce the margins and padding on the text.

- Reduce the size of an image in a cell. Often this means copying the image file and making it smaller (but with the same pixels per inch) in a graphics editor.

- Look for hidden items in cells.

- Remove nonbreaking space codes.

- Use colspan to make a title span multiple cells.

- Reduce the number of decimal places in a number.

- Use scientific notation or metric prefixes to reduce the sizes of numbers. And abbr.

9 megaton
9 X 10^6 ton
9e6 ton
18 X 10^9 lb

instead of

18,000,000,000 pounds.

- Put the units of measurement in the header:

WASTE
megaton
9.00
12.50

instead of

WASTE
9.00 megaton
12.50 megaton

- Change some capitals to miniscules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.