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 4099898
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:29:47+00:00 2026-05-20T20:29:47+00:00

I have an element which appears on many pages and I would like to

  • 0

I have an element which appears on many pages and I would like to style it differently based on the class of the high-level div which it is present in. For example, if I want to change the color of my logo depending on the “type” of page it is present on. Then let’s say these types can be grouped (so typeA, typeB and typeC should use one color while typeD and typeE should use another). Also, as high-level div’s these types are used for other things as well so they cannot be merged.

.typeA #logo,
.typeB #logo,
.typeC #logo{
color: #ffffff;
}

.typeD #logo,
.typeE #logo,{
color: #000000;
}

Is there a way to chain together with some selector so that I don’t have to make this code look so nasty. This example is small but the real-world version involves a whole lot more types. Is there a way to do something like:

.typeA || .typeB || .typeC #logo{
color: #ffffff;
}
  • 1 1 Answer
  • 3 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-20T20:29:47+00:00Added an answer on May 20, 2026 at 8:29 pm

    As others said, CSS doesn’t support that kind of grouping.

    If you have control over your markup, why not just add a common class to each group of type classes then select that common class?

    Example:

    <div class="typeA type1">
        <span id="logo">Site Title</span>
    </div>
    
    <div class="typeD type2">
        <span id="logo">Site Title</span>
    </div>
    
    .type1 #logo { color: #ffffff; }
    .type2 #logo { color: #000000; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a lightbox-like div which appears over pages to present scrollable content. In
I have a div element which is made jquery Resizable. It has alsoResize option
I have a setup like this: <div class=item> <img src=.../> <span class=item-detail></span> <span class=item-detail></span>
I have an alert div , which appears when a user clicks on a
I have an element which may contain very big amounts of data, but I
I have an element which autosaves its contents via an AJAX call. Currently, whenever
On a page I have different element which I bound yo different Ajax calls.
I have the following element which specifies the size=15. However the rendered element, which
I want my application to have a zoomable element which will allow the XAML
I have foreach function which calls specified function on every element which it contains.

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.