CSS inheritance: applying selector for itself and every descendant
Get a custom user CSS and type thi开发者_如何学Pythons
.answered-accepted {
color: white !important;
background: #090 !important;
}
Now go to answers.unity3d and look for an accepted answer. The design looks bad, because the <strong> in there overrides the customization. The fix I've found is this:
.answered-accepted, .answered-accepted * {
color: white !important;
background: #090 !important;
}
Now it looks fine on the website, but the code looks ugly!! How can I do this without repeating the class name?
How about
.answered-accepted strong {
font-weight: normal;
}
.answered-accepted strong {
font-weight: inherit;
}
This will make the <strong> inherit the font-weight from the most direct parent so you can keep all the data in one place. You can inherit any other properties you want the <strong> to take from .answer-accepted.
Only problem is that IE7 and earlier don't support it, so you may still need your hack....
加载中,请稍侯......
精彩评论