Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6710547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:02:07+00:00 2026-05-26T08:02:07+00:00

This is a confusing behavior that I’m seeing in FireFox and Chrome: I have

  • 0

This is a confusing behavior that I’m seeing in FireFox and Chrome: I have one HTML file with styles from two CSS files. Sometimes styles apply from second file and sometimes from first file. The weird behavior can be seen in the following example:

HTML file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="cssTHTDquestion1.css"/>
<link rel="stylesheet" href="cssTHTDquestion2.css"/>
</head>
<body>
<table>
<tr><th>header 1</th><th>header 2</th><th>header 3</th></tr>
<td>data 1</td><td>data 2</td><td>data 3</td></table>
</body>
</html>

cssTHTDquestion1.css:

table th,table td{
    background-color:red;
}

cssTHTDquestion2.css:

th,td{
    background-color:green;
}

Now I would expect to see this output (because cssTHTDquestion2.css is included after cssTHTDquestion1.css):

enter image description here

But instead I get this (which means styles from cssTHTDquestion1.css had a higher priority even though cssTHTDquestion2.css sets the latest settings):

enter image description here

Even Firebug (quite unexpectedly) shows that settings from cssTHTDquestion1.css are applied:

enter image description here

In order to fix it I can change the cssTHTDquestion2.css to look like this:

table th,table td{
    background-color:green;
}

But why changing th,td to table th,table td changes the priority? what am I missing here? Why the color is being applied from cssTHTDquestion1.css rather than cssTHTDquestion2.css? cssTHTDquestion2.css was included later (in HTML code) so I assume it has higher priority.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:02:08+00:00Added an answer on May 26, 2026 at 8:02 am

    table td is more specific than just td.

    If you don’t understand it, try to describe the selector, and it may seem obvious:
    table td = Select <td> which is a child of <table>
    td = select any <td>.

    For the basic understanding of specifity, see http://www.w3.org/TR/css3-selectors/#specificity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one had me going crazy for awhile. I have an app that was
This is confusing me, so this question will probably be confusing. I have a
I know this sounds confusing: I have just built some basic prev/next pagination for
Maybe my coffee is not strong enough this morning, but this behavior is confusing
I right now have a problem that is rather confusing to me: I have
It seems that HTML 5 is going to be supported (partially) by Firefox 3.1
This seems confusing to me - im creating a class library, and adding all
Right this is confusing me quite a bit, i'm not sure if any of
I find this pretty confusing. When you want to rotate a view, it's going
I'm slowly learning the ins and outs of LINQtoSQL, but this is confusing me.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.