Saturday 15 March 2014

Css Cascade breaking for guru -


I need some help on a clear waterfall problem ... not so clear

override me There is a few CSS child's style, with the same style (012) the second style, without taking the definition of order in the css sheet ...

Here is a clear example in Jeffield :

Therefore the style is required:

  • Do not add a third selector (just modify the two)
  • Style perception (Full green before red)
  • Keep both selectors equal, if you change the green selector, then a selector should be equal.
  • The real HTML is provided as one (one is not just inside a div child)

    For example, if .green div A becomes:

      .green> * A   

    Then there should be a red selector:

      .red & gt; The second link should be exactly the same selector (except the name of the color)  

    Edit: Why do I have to:

    My In the site you can customize your theme (color). But when you look at another user, you see his profile in his own color theme, but inside his subject. So a green theme can be embedded inside a red theme ... there are more than 10 topics, so I do not style each combination (green> gt; red, red & gt; green, blue & gt; red etc.)

    So you have to modify both rules in the same way, yes? You just need to look at the HTML side and find out how you can select an anchor so that they are more specific. In your example, you can see that both the HTMLs are .red and .green , they are away from the anchor, so that they can change them strictly. There is an anchor which is the only div. Now, .red will not touch .green because it is two div s away:

      .green & gt; Div & gt; A {color: green;} .red & gt; Div & gt; One {color: red;}   

    for your example is JSFDial:


    Update with the edit of OP

    One thing you can try is a consistent theming conference (this may be a different feature or prefix) Take this CSS:

      .theme-green A, [class * = "theme-"] .theme-green one {color: green;} .theme-red a, [class * = "subject-"]. Theme-Red One {Color: Red;}   

    Below all topics starting with topic - We can use above to override styles Are there. Here, line 3 overrides line 1 (Normally), but the new line overrides 2 line 3, which is what you want (green theme inside red theme). Of course, the downside is that you're repeating your CSS code.

    Here's the new JSField:

No comments:

Post a Comment