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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:02:31+00:00 2026-06-17T08:02:31+00:00

I have 2 CSS files defining 2 sets of CSS rules for the same

  • 0

I have 2 CSS files defining 2 sets of CSS rules for the same CSSResource. Can I somehow apply some-sort of scope so that the styles from one css file don’t override the styles from the other css file?

A simplified Example:

CSSResource

public interface Style extends CssResource {
String box_bkg();
}

Style1.CSS

.box_bkg {
background-color: red;
}

Style2.CSS

.box_bkg {
background-color: yellow;
}

ClientBundle

public interface BoxBundle extends ClientBundle {
    @Source("css/Style1.css")
    MyClass.Style redBoxStyle();

    @Source("css/Style2.css")
    MyClass.Style yellowBoxStyle();
}

When I look at the HTML generated, I see that the obfuscated class-name is the same regardless of which BoxBundle method it came from. So the boxes are either all yellow or red. How can I style the boxes differently if the obfuscated name is the same?

Thanks

  • 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-17T08:02:32+00:00Added an answer on June 17, 2026 at 8:02 am

    The obfuscated class names are computed from the CssResource sub-interface and method names. If you want different class names, you have to make at least one subinterface of MyClass.Style and use it as the return type for the method(s) in BoxBundle; the goal is that the two methods have different return types:

    public interface BoxBundle extends ClientBundle {
       @Source("css/Style1.css")
       Style1 redBoxStyle();
    
       @Source("css/Style2.css")
       Style2 yellowBoxStyle();
    
       interface Style1 extends MyClass.Style { }
       interface Style2 extends MyClass.Style { }
    }
    

    See also https://code.google.com/p/google-web-toolkit/issues/detail?id=6144

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

Sidebar

Related Questions

I have some css files that i need to use in RTL direction template.
I have some css files that are deployed in a feature scoped to site
I know that you can have CSS on External Files, using a <style> tag
I'm using Drupal and I notice that if I have my CSS files aggregated
I have several large CSS files and making a change can sometimes take a
I have a number of .css files spread across some directories. I need to
I have a parent SCSS file that is importing my other CSS files: @import
I have some pages that use the master page and apply a theme. Some
I have seen some css files use -moz , but I have never used
I have two CSS files and I can only edit the 2nd file. My

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.