CSS & Tables

They have: 4 posts

Joined: Dec 2001

Hi

Ive set all my font styles and they stay the same, but when I switch the view text mode to higher or smaller the tables seem to expand (higher text size) or shrink (low text size). What part of css would make them stay the same please. Thanks

Rory

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

It's not the CSS that's causing the tables to expand, it's the font size.

If you want to be able to increase or decrease your font size, without affecting the table size, you will have to use absolute widths for the table instead of percentages.

If you want to have the table fluid and resizable, you will have to set the font size in the CSS in px so it isn't resizable.

There is no inbetween.

Smiling Suzanne

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

I'm no expert but I found this link:
http://www.faqts.com/knowledge_base/view.phtml/aid/8553/fid/337

Also, I checked some of my sites and in pages were I am using something like this below it will let you resize:

<style type="text/css">
A:link { text-decoration: none; color:"#000000" }
A:visited { text-decoration: none; color:"#000000" }
A:hover { text-decoration: none; color:"FF0000" }
</style>
'

BUT when I used something like this it doesn't:
<td valign="top" height="190" class="main">'

That is a good question. I will be waiting for Suzanne to give you the correct answer.Wink

OPPPS...She beat me to the punch.

They have: 4 posts

Joined: Dec 2001

So the tables will still move unless I have the tables and tds set to pixles and not percentages then ..?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Having the tables in percentages means that they can move about as needed.

Unfortunately the max/min concept (in CSS) isn't supported at this time, so I can't offer you a CSS solution to table sizing.

Smiling Suzanne

They have: 4 posts

Joined: Dec 2001

I was looking at another site that the tables did not resize, but they used percentage on all the tables, would it mean using a fixed font on the td instead and not the table? Also, does it mean the height as well as the width needs to be fixed in pixels? Should I even be worrying about it ..heres the page: (its still under construction)
http://www.aspbahamas.com/index.asp

by the way im more into coding then design, doing vbscript in ASP for a couple of years now, which is why im just getting into CSS Smiling

thanks

Rory

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

No, even with a fixed font, the tables will resize based on the text if they are in percentages. However, there are some things that appear to be exceptions (they aren't).

1. using a percentage table within an absolute table cell -- it won't change shape, but it's the parent td that is keeping it from changing.

2. Using images or formatting the text so it doesn't expand if there is more room.

3. Putting the (invalid) attribute in a td (can cause all sorts of other issues, though).

You can mix a relative table with absolute cells, too. So the table could be 100%, but the first column set to 150 pixels.

Or the other way around -- table set to 500 pixels, but the columns set to percentages or not set at all, just dependent on the content.

***

It's best not to set the height at all, let the content set the height. Height is deprecated.

Smiling Suzanne

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.