Skip to main content

All Questions

3 votes
1 answer
179 views

CSS inheritance vs CSS specificity

I was in a Web Development Class in my University Computer Science Department and the teacher asked the class: "Why a class selector rule was getting applied over a tag selector rule (see example code)...
Sarah Adkins's user avatar
0 votes
0 answers
79 views

Is the specificity in CSS3 different than in CSS2.1?

I have been reading up on specificity these days, and I find confusing some claims from the websites, especially from one which I find quite relevant (as far as other CSS materials go). On this ...
user avatar
1 vote
1 answer
71 views

Check which properties were inherited by the element

If you click F12 in a page in Google Chrome, you'll see the developer's console. The next tab that appears (right to "Styles") is "Computed". If you open that tab up, you'll see what are the ...
user2981788's user avatar
3 votes
4 answers
9k views

How to prevent a HTML element from being targeted by a CSS rule?

Here is a difficulty I am trying to solve. I am working inside a client's page to develop a scroller interface. Basically, I cannot change the doctype, the surrounding elements and the stylesheets or ...
barakadam's user avatar
  • 2,269
5 votes
3 answers
902 views

CSS specificity and/or inheritance with ancestors

I'm trying to theme some buttons according to their ancestors (not parents, especialy), so... I have the following HTML structure <body class="theme-a"> <section class="container"> &...
Chris X's user avatar
  • 911
8 votes
4 answers
2k views

Why doesn't my child element inherit color from its parent when parent has more specific selector?

Why in the following code world is blue rather than red? The specificity of .my_class is 0,0,1,0, but it should inherit the color of #my_id whose specificity is higher at (0,1,0,0). #my_id { ...
Misha Moroshko's user avatar