Jump to content

Multiple tags & Table Width


EriRyoutan

Recommended Posts

First off, Hi!!

Okay, now that that's over with...


First thing I was asking: multiple tags.

Is there a way to do something like...

.something td{stuff} th{stuff}

cause every time I try it ends up making the th stuff default, or it dosen't recognize it...


Secondly...

I want to make a table width automatic, but not over 100% (I don't want a scroll bar on the bottom) ...

... Heeelp? Please?
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]For the first one, just do this:
.something td {}
.something th{}[/quote]
Doing that could produce a lot of redundant CSS, especially if a lot of elements are being combined, or there are a lot of properties required for each.

[!--quoteo(post=362703:date=Apr 7 2006, 09:44 PM:name=EriRyoutan)--][div class=\'quotetop\']QUOTE(EriRyoutan @ Apr 7 2006, 09:44 PM) [snapback]362703[/snapback][/div][div class=\'quotemain\'][!--quotec--]First off, Hi!!

Okay, now that that's over with...
First thing I was asking: multiple tags.

Is there a way to do something like...

.something td{stuff} th{stuff}

cause every time I try it ends up making the th stuff default, or it dosen't recognize it...
Secondly...

I want to make a table width automatic, but not over 100% (I don't want a scroll bar on the bottom) ...

... Heeelp? Please?
[/quote]
Are you sure that's what you want to do?

.something will apply the style to anything that has the CLASS "something", regardless of the element.

td{stuff} will apply the style to any TD tag.
th{stuff} will apply the style to any TH tag.

But you've neglected to specify what style should be used for the "something" CLASS. Might you instead want to do this:

[code]<style type="text/css">
.something,td,th{stuff}
</style>[/code]
...which would apply the style to any TD or TH tag, as well as any element with a "something" CLASS?

Table width is automatically adjusted to the width of the largest element inside it. There is a CSS2 property called MAX-WIDTH, but Internet Explorer does not support it -- even Internet Explorer 7.0, which is only available to Windows XP users.

[a href=\"http://www.svendtofte.com/code/max_width_in_ie/\" target=\"_blank\"]Here[/a]'s a site which has a trick using Javascript to force IE to adopt a MAX-WIDTH type of thing, but not everyone has Javascript enabled, so I wouldn't rely on it too heavily.
Link to comment
Share on other sites

... okay, just to make things easier... (?) Is there somewhere that gives good help on selectors? I've looked around, and they only give the basics, or just kind of... expect you to know it. ><;

I think
.st td,.st th{stuff}
worked... might be wrong, tho... I'll go check...


and as for the table, I know it automatically updates to the widest element, but the problem is that I've got a page that dynamically updates its pictures (all of which have different widths) (go PHP!)

I want to leave it so that it automatically resizes, but without the chance of the scrollbar at the bottom if they're using lower resolutions...

other options would be appreciated. -smiles-
Link to comment
Share on other sites

[!--quoteo(post=362805:date=Apr 8 2006, 10:35 AM:name=moberemk)--][div class=\'quotetop\']QUOTE(moberemk @ Apr 8 2006, 10:35 AM) [snapback]362805[/snapback][/div][div class=\'quotemain\'][!--quotec--]
That's not right. That selector would say "apply the same thing to the something class, the td tag, and the th tag." That wouldn't work, would it?
[/quote]
My understanding is that was what was desired... to have all three (TD, TH, and anything with the "something" CLASS) share the same attributes. Hence why they were all listed together on the same line. I may be mistaken.

If you desire only TD and TH tags with the CLASS of "something" to share properties, you could use:

[code]TD[class=something], TH[class=something] { stuff }[/code]

[!--quoteo(post=362806:date=Apr 8 2006, 10:43 AM:name=EriRyoutan)--][div class=\'quotetop\']QUOTE(EriRyoutan @ Apr 8 2006, 10:43 AM) [snapback]362806[/snapback][/div][div class=\'quotemain\'][!--quotec--]
... okay, just to make things easier... (?) Is there somewhere that gives good help on selectors? I've looked around, and they only give the basics, or just kind of... expect you to know it. ><;

I think
.st td,.st th{stuff}
worked... might be wrong, tho... I'll go check...
and as for the table, I know it automatically updates to the widest element, but the problem is that I've got a page that dynamically updates its pictures (all of which have different widths) (go PHP!)

I want to leave it so that it automatically resizes, but without the chance of the scrollbar at the bottom if they're using lower resolutions...

other options would be appreciated. -smiles-
[/quote]
I like [a href=\"http://www.w3.org/TR/REC-CSS2/selector.html\" target=\"_blank\"]the W3C page[/a], but it's rather technical. You could try [a href=\"http://css.maxdesign.com.au/selectutorial/\" target=\"_blank\"]this tutorial[/a].

As mentioned, the only way I know of to prevent the page from scrolling while having the table snap to the width of the content is MAX-WIDTH. MAX-WIDTH will not allow the table to expand past the given size constraint, but the table will resize itself automatically up until that point. Internet Explorer doesn't support MAX-WIDTH though, so it may be moot.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.