The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
I'm getting the background color from .alternate to show up in the middle column, but I'm not getting a border. Is border a valid property for column? What am I doing wrong?
Short answer: because tables suck and you should really be using <div>s
Longer, less-biased answer: As I understand it (and please, someone correct me if I'm wrong), tables (and cells) have their own "border" that overrides user-defined borders and must therefore be "removed" and have new border definitions applied.
Yeah, I don't really plan on using tables very often. But, for the sake of completeness, I'm learning tables anyhow by way of HTMLdog - which is a great site, but doesn't go very in-depth from what I can tell.
KrunkMcGrunk on
0
Seguerof the VoidSydney, AustraliaRegistered Userregular
Short answer: because tables suck and you should really be using <div>s
Longer, less-biased answer: As I understand it (and please, someone correct me if I'm wrong), tables (and cells) have their own "border" that overrides user-defined borders and must therefore be "removed" and have new border definitions applied.
Tables are fine (and better!) for tabular data.
Your original border declaration should have given you a border, but border-collapse will make it look nicer (generally).
Quick Google results which should be able to give you some more info:
The first way does have 'more' CSS, but isn't abnormal. As far as CSS goes, it's still simple. It also has the benefit of allowing you to easily switch styles of each column as needed.
Your second way looks cleaner, but down the line if you want to change the 3rd column to purple, you would have to go in and change your HTML.
Basically both ways are valid, but the first way is more flexible. Saving a few characters in your CSS file isn't worth the loss of flexibility IMO.
You can make the tbody element scroll in Mozilla, by applying the style overflow: auto; max-height: [whatever] to it. You will then see the header and footer kept in place and a vertical scroll bar to the right of the body. You should use the max-height property because IE doesn't recognise it and so it is safer than using the height property, which IE would apply to every row.
I just can't figure out where exactly I'm supposed to apply the style. Like, is it supposed to go in my CSS as:
tbody {
overflow: auto; max-height: 5px;
}
Or does it go somewhere else? I know I have it wrong right now, as it does nothing.
That way, when the table rows in <tbody> go beyond the height set in the CSS, it'll gain scrollbars, but only on that part. Anything in the thead and/or tfoot will remain in place.
Edit: Slight correction, didn't realize tfoot has to go before tbody, never had to use it before.
Hmm... in theory that should work I'm pretty sure. Unless the max-height is just way too small, not even enough for one row to appear? That's the only thing that slightly stands out to me.
What browser(s) are you viewing the tests in anyway? The only one that you have to do extra tricks in for the scrolling table body to work is IE7 and below I *think*.
max-height is valid and supported in all major browsers though. Very weird, not sure why it wouldn't work like that.
Dranyth on
0
Seguerof the VoidSydney, AustraliaRegistered Userregular
edited September 2010
max-height: 5px might not have been giving it enough "room" to introduce the scrollbar?
Krunk, might be an idea if you can find somewhere to upload these files when you're working on them, cos then we can take a look without having to replicate it ourselves.
Oh - you've got Firebug and Web Developer toolbar, right? They're addons for Firefox and help lots.
max-height: 5px might not have been giving it enough "room" to introduce the scrollbar?
Krunk, might be an idea if you can find somewhere to upload these files when you're working on them, cos then we can take a look without having to replicate it ourselves.
Oh - you've got Firebug and Web Developer toolbar, right? They're addons for Firefox and help lots.
I don't have those addons, but I will get them! I've heard them highly recommended.
And, I think you might be right about 5px not being enough room to introduce the scrollbar. That's about the only thing I can think of.
Posts
to your table and it should work.
Either in the table tag: or in your css: However that will apply to all tables.
Longer, less-biased answer: As I understand it (and please, someone correct me if I'm wrong), tables (and cells) have their own "border" that overrides user-defined borders and must therefore be "removed" and have new border definitions applied.
Tables are fine (and better!) for tabular data.
Your original border declaration should have given you a border, but border-collapse will make it look nicer (generally).
Quick Google results which should be able to give you some more info:
http://www.search-this.com/2007/04/11/styling-table-columns-with-css/
http://www.w3schools.com/tags/tag_colgroup.asp
And in this example:
Couldn't that be greatly simplified by applying a CSS as such:
Then, have your HTML look like
In place of applying a separate class for every column in the table?
That's valid HTML, right? And a lot easier to code, as well as being lighter? Or am I way off?
The first way does have 'more' CSS, but isn't abnormal. As far as CSS goes, it's still simple. It also has the benefit of allowing you to easily switch styles of each column as needed.
Your second way looks cleaner, but down the line if you want to change the 3rd column to purple, you would have to go in and change your HTML.
Basically both ways are valid, but the first way is more flexible. Saving a few characters in your CSS file isn't worth the loss of flexibility IMO.
I just can't figure out where exactly I'm supposed to apply the style. Like, is it supposed to go in my CSS as:
Or does it go somewhere else? I know I have it wrong right now, as it does nothing.
That way, when the table rows in <tbody> go beyond the height set in the CSS, it'll gain scrollbars, but only on that part. Anything in the thead and/or tfoot will remain in place.
Edit: Slight correction, didn't realize tfoot has to go before tbody, never had to use it before.
Here's my HTML
Here's my CSS re: tables
What browser(s) are you viewing the tests in anyway? The only one that you have to do extra tricks in for the scrolling table body to work is IE7 and below I *think*.
I just tried out this:
And it worked. Maybe I because I had overflow before I defined the table size? Or maybe max-height isn't a valid attribute?
Krunk, might be an idea if you can find somewhere to upload these files when you're working on them, cos then we can take a look without having to replicate it ourselves.
Oh - you've got Firebug and Web Developer toolbar, right? They're addons for Firefox and help lots.
I don't have those addons, but I will get them! I've heard them highly recommended.
And, I think you might be right about 5px not being enough room to introduce the scrollbar. That's about the only thing I can think of.