473,416 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

CSS Validation issue

Hi everybody,

Here's a little problem that's been bothering me. I have a stylesheet, in
which I define the looks of a table on my website. Each alternating row
gets a different color, as is usually done on most websites.

This means that each alternating <trgets an extra class="alt" attribute -
no problems so far.

After validating my CSS, however, I found that I still had three errors
left:
* Line : 253 (Level : 1) You have no background-color with your color :
td
* Line : 259 (Level : 1) You have no background-color with your color :
td a
* Line : 264 (Level : 1) You have no background-color with your color :
td a:hover

I'd like to correct these, but as soon as I put in a background-color with
my color, the alternating color that was set by the tr disappears, quite
logically.

How do I fix this?

I can always add the alternate class to the tds instead of the trs, but
that means that the size of my resulting html file will increase a lot
(each tr has a lot of tds).

Thanks in advance,

Ikke
Nov 2 '06 #1
5 1584
On Thu, 2 Nov 2006 13:51:18 +0000, Ikke wrote
(in article <Xn************************@195.130.132.70>):
Hi everybody,

Here's a little problem that's been bothering me. I have a stylesheet, in
which I define the looks of a table on my website. Each alternating row
gets a different color, as is usually done on most websites.

This means that each alternating <trgets an extra class="alt" attribute -
no problems so far.

After validating my CSS, however, I found that I still had three errors
left:
* Line : 253 (Level : 1) You have no background-color with your color :
td
* Line : 259 (Level : 1) You have no background-color with your color :
td a
* Line : 264 (Level : 1) You have no background-color with your color :
td a:hover

I'd like to correct these, but as soon as I put in a background-color with
my color, the alternating color that was set by the tr disappears, quite
logically.

How do I fix this?

I can always add the alternate class to the tds instead of the trs, but
that means that the size of my resulting html file will increase a lot
(each tr has a lot of tds).

Thanks in advance,
Hi

I like to do this alternating colours for the rows in tables.

I tend to go "odds" and "evens" with my class names for this so below
is the CSS for classes called "nscodd" and "nsceven" in a fairly
standard table. This validates. As you can see "nscodd" is not in fact
doing anything but I keep it there in case I change my mind about how I
want my alternating rows coloured.

tr.nscodd { background-color: inherit; color: inherit; }
tr.nsceven { background-color: #D8D8D8; color: inherit; }


--
Patrick
Brighton, UK

<http://www.patrickjames.me.uk>

Nov 2 '06 #2
patrick j <pa*****@jamesnews.orangehome.co.ukwrote in
news:00*****************************@News.Individu al.Net:

<snip>
Hi

I like to do this alternating colours for the rows in tables.

I tend to go "odds" and "evens" with my class names for this so below
is the CSS for classes called "nscodd" and "nsceven" in a fairly
standard table. This validates. As you can see "nscodd" is not in fact
doing anything but I keep it there in case I change my mind about how
I want my alternating rows coloured.

tr.nscodd { background-color: inherit; color: inherit; }
tr.nsceven { background-color: #D8D8D8; color: inherit; }
Thanks for your suggestion - it has helped me a lot.

My end solution looks like this:
- drop all color declarations for the tds that were already there
- add the declarations in "tr", "tr a" and "tr a:hover"
- add alternate declarations in "tr.alt", "tr.alt a", and "tr.alt a:hover"

Works like a charm!

Best regards,

Ikke
Nov 2 '06 #3
Scripsit Ikke:
>tr.nscodd { background-color: inherit; color: inherit; }
tr.nsceven { background-color: #D8D8D8; color: inherit; }

Thanks for your suggestion - it has helped me a lot.
That's an illusion. IE does not support the value inherit.

So you have silenced the messenger (the CSS checker, or "validator"), but
the problem it tried to tell you about is still there.

Always set background and color together, to explicit values, if you set
either of them for an element.
Works like a charm!
You misspelled "illusion". :-)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Nov 2 '06 #4
"Jukka K. Korpela" <jk******@cs.tut.fiwrote in
news:ST*******************@reader1.news.jippii.net :
Scripsit Ikke:
>>tr.nscodd { background-color: inherit; color: inherit; }
tr.nsceven { background-color: #D8D8D8; color: inherit; }

Thanks for your suggestion - it has helped me a lot.

That's an illusion. IE does not support the value inherit.

So you have silenced the messenger (the CSS checker, or "validator"),
but the problem it tried to tell you about is still there.

Always set background and color together, to explicit values, if you
set either of them for an element.
>Works like a charm!

You misspelled "illusion". :-)
Actually, I took the example posted by Patrick, and altered it to suit my
needs. While doing that, I already explicitly set both colors (mainly
because I'm new to CSS and have never used inherit).

Anyway, thanks for the warning - another lesson learned...

Best regards,

Ikke
Nov 2 '06 #5
On Thu, 2 Nov 2006 23:20:25 +0000, Ikke wrote
(in article <Xn***********************@195.130.132.70>):
Actually, I took the example posted by Patrick, and altered it to suit my
needs. While doing that, I already explicitly set both colors (mainly
because I'm new to CSS and have never used inherit).

Anyway, thanks for the warning - another lesson learned...
I didn't know inherit doesn't work in IE myself :)

I wonder if it works in IE 7?

--
Patrick
Brighton, UK

<http://www.patrickjames.me.uk>

Nov 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Linders | last post by:
Hi, In my form, I have a checkbox that must be checked in order to process the form. By default, I want it to be checked when the page first appears. I can do that easily enough by hardcoding...
0
by: Herman Geldenhuys | last post by:
Oops! Sorry guys, wrong list... Apologies. ----- Original Message ----- From: Herman Geldenhuys To: python-list@python.org Sent: Wednesday, January 28, 2004 4:54 PM Subject: Security...
2
by: Angel | last post by:
Hi there, I need help pls..I'm using c# on a webform and I have this regex validation for email addresses: ValidationExpression ="\w+(\w+)*@\w+(\w+)*\.\w+(\w+)* " I'm having isssues when submit...
0
by: Ric Castagna | last post by:
Greetings, oh wise ones... Here's one I haven't seen, and haven't seen mention of in the various groups. I have a group of pages with validation. All works well on my development machine, but...
2
by: Mark Sandfox | last post by:
I have a tricky control validation issue. I have probably designed this the wrong way but here is what I have. I have 6 TextBoxes; tbPN, tbA, tbC, tbS, tbZ, tbDOB and there are 20 of each with...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
4
by: andersoj | last post by:
I have a page that has some required field validators created in the aspx, and other validators created in the Page_Load event. In IE, all validation works as expected. In Firefox, ASPX...
3
by: Adam Knight | last post by:
Hi all, I am having a really strange validation issue. Validation controls work fine on local machine, but don't work on production server. Any thoughts...this is bugging me out? Cheers,
2
by: thehuby | last post by:
I have a validation issue in my RSS but I cannot quite fathom out where it is. My only guess is some kind of white space issue but I have tried rewriting it and it doesn't seem to have made any...
1
by: dburdett | last post by:
I am kind of new with building a schema and being able to validate a XML file against the schema stored on our web site. I have schema that I have built that resides at: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.