default cell width

J

Jeff Thies

I have a table row where I've set the cell widths:

td{width: 200px}

I'd like one cell to be the default unspecified (assuming I have a class
for that).

How do I do that?

And, this really is tabular data. My current definition for that is that
there is a "th" that describes the column, always exceptions of course!

Jeff
 
J

Jukka K. Korpela

Jeff Thies said:
I have a table row where I've set the cell widths:

td{width: 200px}

Normally widths should not be set in pixels, since you cannot know how
much space in pixels will be needed for the content presented in a font
size that the user can read. But the same problem exists when other units
(all praise em!) are used.
I'd like one cell to be the default unspecified (assuming I have a
class for that).

Normally there's no way in CSS to say "use the defaults that you would
use if I hadn't opened my mouth". To leave an element's property
unspecified, don't so anything - e.g., put all other elements into a
class and specify property for them only. Yeah, I know, awkward.

But unless I'm missing something, for table cell's width you can say
width: auto
to make the browser behave according to its defaults for the cell. For a
cell, width: auto means that the cell is as wide as needed for the
content, with word wrapping applied if needed to keep the entire table's
width within the available horizontal space.
And, this really is tabular data. My current definition for that is
that there is a "th" that describes the column, always exceptions of
course!

Sounds like working definition to me. I would go a bit farther and say
that a table is tabular data if it has column headers _or could have_
although we might omit them because they are obvious, or something.
 
J

Jeff Thies

Jukka said:
Normally widths should not be set in pixels, since you cannot know how
much space in pixels will be needed for the content presented in a font
size that the user can read. But the same problem exists when other units
(all praise em!) are used.

I'm just moving to setting these things in a stylesheet. I don't believe
I could have done this: said:
Normally there's no way in CSS to say "use the defaults that you would
use if I hadn't opened my mouth". To leave an element's property
unspecified, don't so anything - e.g., put all other elements into a
class and specify property for them only. Yeah, I know, awkward.

Yeah, the more pages I edit, the more I see the benefits of less
classes. And so many of those class names seemed like a good name to
someone at the time!!!
But unless I'm missing something, for table cell's width you can say
width: auto
to make the browser behave according to its defaults for the cell. For a
cell, width: auto means that the cell is as wide as needed for the
content, with word wrapping applied if needed to keep the entire table's
width within the available horizontal space.

No, you're not missing anything. I was. I'll try that as all I want is
for that cell to accomadate the contents. The others need to wrap. It's
holding an image and I currently just have the width set to a small number.
Sounds like working definition to me. I would go a bit farther and say
that a table is tabular data if it has column headers _or could have_

Hmm, I was just going to ask how you got plain text to underline, but I
see now that Thunderbird had done that with your underscore leading and
trailing. Is that a common "short cut" for underlined? TBird also bolds
asterisk bound text and makes smilies which I'm not sure if I like or not!

Cheers,
Jeff
 
J

Jukka K. Korpela

Jeff Thies said:
It's
holding an image and I currently just have the width set to a small
number.

Then I guess it actually works that way too, unless you set table-layout
to fixed. When table-layout is auto (the default), a browser
automatically uses a width larger than specified if the content doesn't
fit in otherwise.

A more logical move would be to set the width equal to the width of the
image - and this is of course a situation where px is the right unit.
Hmm, I was just going to ask how you got plain text to underline, but
I see now that Thunderbird had done that with your underscore leading
and trailing. Is that a common "short cut" for underlined?

It's a pretty old though not very widely known convention on Usenet to
use underscores (or sometimes asterisks) around a word for emphasis.
In the old days, people were assumed to understand this just from the
underscores, but later newsreaders added the feature of actually
interpreting the underscores. As markup, in a sense. They omit the "tags"
and display the content as underlined or otherwise emphasized. Similarly
many newsreaders interpret slashes as indicating italics.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top