View Full Version : CSS for tables?

Sep 3rd, 2004, 05:41 AM
First let me say this is not a table for layout issue for those who saw the thread title and smelled blood in the waters....

I actually need a table, for, well a table! Semantically and functionally it makes sense. I haven't bothered with tables in a while and I'm a little puzzled if I can use CSS to style the table and it's children or not? W3C seems to say I can but in MOZ I can't even get the background color to render, among other things such as the border.

Is browser support for CSS on table elements limited? I would think that MOZ would support it. IE has a damn hijack virus that I **still** cannot get rid of so I'm not even touching it for now.

Here's a quick snip of the css, some works (such as width, height) some don't such as background-color (or background - I have tried both ways).

table {
width: 100%;
height: auto;
background: rgb(100,100,100);

Sep 3rd, 2004, 05:47 AM
long day today...

I have a bad habbit of starting my pages with the style sheet in the head, then later making it external. Well I had 'saved as' early on and still had the internal style sheet so all the styling looked ok on the rest of the page, but I added my table styles in the external style sheet (which was not linked).


all is well now, thanks for your concern :D

Sep 3rd, 2004, 08:18 PM
Why do you want to use the rgb() format rather than a hex value?

Roy Sinclair
Sep 3rd, 2004, 09:24 PM
Go get BHODemon and see if it can detect the IE hijacker.


Sep 3rd, 2004, 09:42 PM
|V|[agnus']Why do you want to use the rgb() format rather than a hex value?

It's easier for me to work with when I'm playing around with color pallets. I usually make pallets in paint or photoshop to get the color scheme I want for the page, I used to always use the hex format but got tired of converting it.

Is there a downside to using rgb() ?

Sep 3rd, 2004, 09:42 PM
Roy, thanks I'll give that a try this afternoon.

Roy Sinclair
Sep 3rd, 2004, 10:01 PM
I forgot to say, keep using Firefox, IE is only good for testing :p

Sep 7th, 2004, 11:09 PM
Nobody ever commented - is using rgb() an unwise approach vs the hex value? I don't see any difference besides maybe a tiny amount of processor power to run the rgb function. I usually convert all my values when I'm done anyway so it really doesn't matter, I'm just wondering.

...finally got that damn hijacker off IE, had to get the latest version of HijackThis, and remove a bunch of junk. :)

Sep 7th, 2004, 11:18 PM
A quick search on "rgb() or hex CSS" produced this link in the top 5:

color schemer forums - css hex or rgb? (http://www.colorschemer.com/forums/showthread.php?t=47)

It would seem the concensus is that it's a matter of preference. However, the last comment makes a point about how not all browsers may support certain color declarations in RGB, but I don't know how accurate that is.

For my taste, it comes down to a matter of consistency and standards: I'd always regarded hexadecimal as the web standard for defining colors, more or less, and as it is generally the most compact while being the most versatile, I prefer it.

Also, if you expand your horizons, consider a situation where you are drawing values from a database. A simple hex string would be easier to deal with and store than a comma delimited rgb list of values. Not by much, but it would be easier. Just a random what-if for ya...

Sep 7th, 2004, 11:39 PM
Actually, all monitors don't support all color spaces accurately:)

It's the same for print calibration as it is for monitor calibration, and an arguement that's been running around for years. If you buy a red shirt from Amazon.com, what's to say the color is the right color? They will accept this as a reason for return now it's such a standard complaint. Your monitor is calibrated by your preferences, most people use it out of the box, some of us calibrate it to our print output which changes the whole ballgame.

While all monitors understand the hex because it's the simplest color base -- really (and I mean REALLY) old browsers may not render the rgb properly. It may just look, well, different... but the irony is, so does the hex as it depends on how your monitor is calibrated.

So if you're (or my) mom has a monitor prior to 1991 (maybe less), it may get confused by your rgb(230, 230, 230) and make it #999 -- not a big deal in my opinion. I find the benefit of rgb, not only because I can match it straight out of illustrator/photoshop and all the others, is I have greater control over color. But that can vary from browser to browser -- thought the http://www.color.org/ (ICC profiles) have made an attempt in the past to offer ways to profile your files for webpage viewing, last I checked, it's met some technical and verbal opposition... that it controls the users computer, which I agree is annoying, and that it's hard to control a users monitor... which I can also agree. A lot of big wig online companies are funding improvements for this, though, so we shall see.

But to answer your question, the drawbacks of rgb values are very minimal -- I would say go ahead and use them, I do all the time. I only use hex now for stuff like a specific hex read or something and I see it before I see the rgb value.


Sep 7th, 2004, 11:49 PM
Yeah, it should be common knowledge to any semi-serious designer that monitors vary widely in their rendering, amongst other factors... I would say all issues concerning the accuracy of color rendering are not worth considering too much as there is little that can be done by the designer/developer to account for so many variables.

I don't really understand the claim that you get more control with the RGB format. There is no value you can specify with three decimal values for your RGB that you can't cover with one six-digit hex value(Or of course the condensed 3-digit value when conditions allow). And last time I checked, you have your hex versions of any color right there with no other commands required in Photoshop and I would assume Illustrator and any other serious editor.

So... what the crap do you mean by that, Brady? :)

Sep 8th, 2004, 02:30 AM
I rarely ever use rgb(). The only time I do is when I'm trying to match the background of a media item such as a QuickTime movie or a simple image to the background of the element in which it is contained. If I feel like I want to be uniform, I convert the three values to hex using a hex calculator. There is no real advantage other than compatibility with some image editing programs.

Sep 8th, 2004, 04:32 AM
I probably have a bias for hex simply because it's not base ten. I like thinking of things differently like that. After I learned binary notation, I was fascinated for days, constantly asking people to give me a random number so I could convert it. Not to show off to them necessarily, just to know. :)

Sep 8th, 2004, 04:46 AM
I learned the basic idea of binary in second grade. It was so fun! I wish I knew everything (except pain).

Sep 8th, 2004, 05:06 AM
Haha... yes, except pain...

Where did you grow up, gohan? They weren't teaching me or anybody I knew binary in second grade. In fact, the only reason I know binary notation is because a teacher I had for a networking class in college bothered to explain it to us. It wasn't even really required of the course. Sadly, it's one of the few things I actually retained from that class. Hahaha, geez... :o

Sep 8th, 2004, 05:10 AM
Haha. I loved to read in grade school. The school library had a book on it. I am also a person who loves mathematics. The book just happened to catch my eye.

Sep 8th, 2004, 05:47 AM
|V|[agnus']So... what the crap do you mean by that, Brady? :)
:D What I meant by greater control over color is simply being able to target RGB values as they're defined. It's much easier for me to compare that to, say, a CMYKOGcm color mix (hi-Fi color for printing) and keep it in the same color scale simply by going from the RGB mix.

In short, it's easier for this designer to control color because I understand the mixes by the math. I could turn the monitor to grayscale and still mix color by it's RGB value or it's CMYK value -- though I could convert that to a Hex number, it doesn't mean a damn thing to me when I look at that hex number later if I don't see the color.

Besides, RGB value is better for you to learn if you're ever going to do design in anything else but web, or if you're going to get into advanced Photoshop curves, it's RGB/CMYK all the way.

But you're right, no answer I've ever received has been anything other than preference... but I would still recommend learning RGB over hex.

Sep 8th, 2004, 06:47 AM
I would recommend learning both! :) Especially if, like you say, you want to get into some serious print design or other non-web media. But since we are talking about the web here... :rolleyes: I kid, I kid...

Sep 8th, 2004, 08:56 PM
ohhh lordy...

maybe I should just remeber all the powers of 15 then I can become a human rgb to hex color converter :D

Sep 8th, 2004, 09:10 PM
Sadly the HSL colour scheme is far from as well supported - but I think the HSL system would be far easier to learn than either of the hexadecimal, decimal or per centual RGB syntaces.

Sep 8th, 2004, 09:15 PM
I personally use hex... habit... although I am converting other things to rgb, but, mainly because they don't support hex, but I'll move to rgb for everything once I know it better.

As for what Brad was saying about screen and print differences, I can't think why he would know about that :p