Forum Moderators: not2easy

Message Too Old, No Replies

Background & Font Colors in Tables with CSS

How to change them?

         

Robert Charlton

12:36 am on May 18, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I've raised this question a number of times in the Google forum and elsewhere... how to handle white text in a dark table so it's not seen as spam... and I haven't really gotten a good answer.

The subject has come up again, I thought I'd give it another try here. Here's the question, with a twist, from an earlier thread...

[webmasterworld.com...]


...when using html font color and bgcolor attributes...

I've assumed that the engines weren't smart enough to detect the table cell background color... so I'd always advised clients, to avoid hidden text penalties, not to use white (or near white) font color attributes with a white page bgcolor attribute, no matter what color the cell background was.

With the advent of css, where clients have wanted light text against a dark cell background, I've advised that they use css to make the text white and simply not specify the font color in html.

But, if the engines are in fact now smart enough to detect the dark cell background, not using the font color="ffffff" specification in a dark cell may make the engines think the text is being hidden.

You can maybe go around in circles on this forever....

The best suggestion I've gotten was that CSS might be used to control both the font color and the cell background color. Will this work, and, if so, what's the best way to do this to avoid any suggestion of spam?

The site I currently need to fix is a fairly large site that's done in convention html, where redoing the whole site isn't in the cards for a while. So I'd like basically to keep the existing table structure and page background tags, and to apply CSS to the fonts and background colors on the offending table only... if that will work.

holly

2:58 am on May 18, 2003 (gmt 0)

10+ Year Member



The site I currently need to fix is a fairly large site that's done in convention html, where redoing the whole site isn't in the cards for a while. So I'd like basically to keep the existing table structure and page background tags, and to apply CSS to the fonts and background colors on the offending table only... if that will work.

This will work fine.

You do not say if that table has all one background color or not? And, you did not mention if there are any other tables on the page.

If no other tables are on the page.
td{color: #fff; background-color: #000;}
This will color the text white and the background black for all td's on the page.

You can place this CSS in the page, or link to an external style sheet with this information[though be aware this item will color all TD with black background and white text for a whole site if in an external style sheet that is linked.

An option for just this table. Assign it a class naming.

td.special{color: #fff; background-color: #000;}

then on the page in EVERY TD where you want this applied...

<td class="special> cell content here </td>
This will color table td that *also* have the class="special". This set of styles will not be applied to all other TDs, only ones with class="special".

hope this makes sense.

holly

Nick_W

5:20 am on May 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Holly,

You'll find anything else you need in this post on Color and Background Properties [webmasterworld.com] Robert.

Nick