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

  • SEARCH
  • Home
  • 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 8929789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:45:03+00:00 2026-06-15T08:45:03+00:00

Is that possible to have two styles for one element with different colors? In

  • 0

Is that possible to have two styles for one element with different colors?

In other words, lets suppose I have following HTML code:

<table class='my_table'>
<th class="style1 style2">LastName</th>
...
</table>

and following CSS:

.my_table th.style1 { 
    background: #aaaaaa; 
}

.my_table th.style2 { 
    background: #bbbbbb; 
} 

I understand that I can remove one style with JavaScript for some condition. But I would like to have two styles and one of them should override another. Is that possible?

  • 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-06-15T08:45:03+00:00Added an answer on June 15, 2026 at 8:45 am

    Yes, you can use any number of classes on an element. CSS uses both the declaration order and the specificity of the selectors to decide which will be overriden.

    For example, if the specificity is the same, the last one is used:

    .style1 { 
        background: #aaaaaa; 
    }
    
    .style2 { 
        background: #bbbbbb; 
    } 
    

    Otherwise, the most specific will be used (the first one on the example below):

    .my_table th.style1 { 
        background: #aaaaaa; 
    }
    
    .style2 { 
        background: #bbbbbb; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two simple margin styles defined, one based off the other. <Style x:Key=marginStyle
Possible Duplicate: Why do this Ruby object have two to_s and inspect methods that
Is it possible to have a type constraint that is an or of two
Possible Duplicate: CSS Selector that applies to elements with two classes So I have
Possible Duplicate: JavaScript: formatting number with exactly two decimals Now that I have got
I have a custom component with one RadioGroup that has two RadioButton, ids @+id/radioButton1
I have two radio buttons what I want is that when I select one
http://mydomain.com/ => 127.0.0.1:4567 but http://mydomain.com/FOO => 127.0.0.1:3000 Is that possible? So far I have:
Is it possible that when you have a webpage, when you open the PDF,
Is it possible to have multiple classes that inherit/extends same class in Google AppEngine

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.