CSS Alternating row color

Hello Experts.
Would like to make every other color in a table light grey
to make it easier to read. Found several websites  that
show snippets like
tr:nth-child(odd)            { background-color:#eee; }
tr:nth-child(even)            { background-color:#fff; }
but when I put them into a page they don't work.

So I found a site that shows the complete page at
and there is an example from this page at
that looks like what is desired.
Like this
CSS-alternating-rowa.gifWhen a VIew>Source is done the code copied below
is displayed.
When the code is pasted into an HTML file I get
Code from View Source
Using IE 10 for both views.
How can the same code, one view from the
web and one viewed from the hard drive
display so differently?


Allen in Dallas


tr:nth-child(even) {
background-color: #0000ff;
color: #ffffff;



Allen PittsBusiness analystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Just checked that code from file / web in FF and IE (8,9,10,11) Works everywhere except IE8 - which is expected because IE8 does not have support for nth-child.

Have you checked the page from other browsers?
Prasadh BaapaatWeb Designer & DeveloperCommented:
Hi 9apit,
I answered to another question by you where CSS borders were not working in your browser....

I had suggested to add the meta tag...  maybe its the same problem again... add below tag to page and check.

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Allen PittsBusiness analystAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.