EriRyoutan Posted April 8, 2006 Share Posted April 8, 2006 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 Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/ Share on other sites More sharing options...
moberemk Posted April 8, 2006 Share Posted April 8, 2006 For the first one, just do this:.something td {}.something th{} Quote Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/#findComment-24937 Share on other sites More sharing options...
Vorotaev Posted April 8, 2006 Share Posted April 8, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/#findComment-25018 Share on other sites More sharing options...
moberemk Posted April 8, 2006 Share Posted April 8, 2006 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 Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/#findComment-25029 Share on other sites More sharing options...
EriRyoutan Posted April 8, 2006 Author Share Posted April 8, 2006 ... 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 Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/#findComment-25030 Share on other sites More sharing options...
Vorotaev Posted April 8, 2006 Share Posted April 8, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/#findComment-25037 Share on other sites More sharing options...
EriRyoutan Posted April 9, 2006 Author Share Posted April 9, 2006 Woo. -dances around a bit- Thanks for everything. I may or may not be back asking more annoying questions later... -offers cookies to anyone who wants them- Quote Link to comment https://forums.phpfreaks.com/topic/6854-multiple-tags-table-width/#findComment-25136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.