Skip to main content
0 votes
0 answers
49 views

Under what circumstances can a CSS rule with specificity 0-0-1 override one with specificity 0-1-0? [duplicate]

In the screenshot below, you can see that a font-family declaration with a rule specificity 0-0-1 is taking precedence over one with specificity 0-1-0. My understanding is that order of rules only ...
Josh's user avatar
  • 1,307
0 votes
0 answers
11 views

CSS Native Nesting specificity cannot be overridden, explanation needed [duplicate]

The problem is that I am unable to override a nested css selector with an exactly matching selector later in the css. It appears the specificity calculation is requiring the override exactly match all ...
Rick Kukiela's user avatar
  • 1,273
0 votes
1 answer
25 views

Precedence in parent/child classes of same specificity [duplicate]

In the given code snippet why font size of h1 element is 36px? I have these questions : If h1 is defined 1st, then the font size of main(i.e. 32px) should be applied on the h1 heading, as it is ...
Shubhang Sahu's user avatar
0 votes
0 answers
44 views

why class selector property is not getting high precedence over type precedence? [duplicate]

I am trying to understand specificity in the css. I have used class selector .grandparent and type selector p for changing the color of all the paragraph inside each.grandparent. What I understand is ...
novice's user avatar
  • 530
0 votes
1 answer
65 views

Why is the selector with lower specificity being applied? [duplicate]

See the "Show" button underneath and to the right of "Open modal" on https://fresh-rfui-test.deno.dev/islands. I have: <button type="button" class="bg-neutral-50 ...
Adam Zerner's user avatar
  • 19.4k
0 votes
1 answer
35 views

css a element selector overriding bottom element selectors

hello, I am trying color my paragraph tag but i unavailable to do because top p tag (element selector) is overriding bottom p tag. it work when i write tag name but i want them to automatically ...
yashlodhi's user avatar
  • 139
4 votes
2 answers
62 views

What is the total specificity for this CSS Selector? button:not(#mainBtn, .cta)

On MDN Web Docs website, they have mentioned that the total specificity for the selector button:not(#mainBtn, .cta) is as follows: | Selector | Identifiers | Classes | Elements | ...
rocketdeveloper's user avatar
0 votes
1 answer
33 views

Why * CSS selector gets precedence in a simple example [duplicate]

While coding today, I ran into a surprise - element CSS rule with no specificity is being used, even when a rule with higher specificity exists. In the example below, I would expect: Text1 is blue ...
Draex_'s user avatar
  • 3,494
4 votes
1 answer
96 views

Why is the font-size, but not the color, property applying to elements?

I'm self-teaching myself Html/Css, kindly explain to me like a dummy(phew!) Help clear the doubt where I tried to target my list items in an unordered list. I realized that color property couldn't be ...
Polycarp Angololo's user avatar
1 vote
2 answers
66 views

Trying to understand specificity calculation in CSS

I am reading MDN docs here. They are explaining specificity in CSS. For button:not(#mainBtn, .cta), specificity is given as 1-0-1. Since, there is one class involved here, I think the specificity ...
user9026's user avatar
  • 970
0 votes
1 answer
858 views

What is the best way to style elements in SCSS based on a class in the parent, such as a theme class

This is an old project. The theme adds a class to body or another root element. I need to style fonts, backgrounds, based on the theme, but this often leads to structures as: .theme-light { ... ....
Paul Pacurar's user avatar
0 votes
0 answers
39 views

element style declared twice in css but css is not appling the stlye declared at last why is it so?

css selector specificity is not behaving the expected way. this is the HTML Code <nav> <p>This is the navigation</p> <a href="blog.html">Blog</a> ...
ShivBalaji's user avatar
0 votes
0 answers
38 views

media query with larger size has more specifity than the media query with smaller size

I have two media queries: `@media (max-width: 815px){ .page .item { margin-right: 5px; } }` `@media (max-width: 655px){ .page .item { margin: 0 auto; ...
Lilly's user avatar
  • 110
-2 votes
2 answers
82 views

my * is taking a higher specificity over my element tag and !important tag

[*" at 0.0 transparency](https://i.sstatic.net/V5fil.png) [*" at 0.5 transparency](https://i.sstatic.net/gfSNP.png) [*" at 1.0 transparency](https://i.sstatic.net/yxOrn.png) The problem ...
Muhammad5777's user avatar
0 votes
0 answers
28 views

Can we put inherited style as the 0 precedence order in this complete cascading order table?

Would it be correct to put *inherited style" as the 0 (lowest) precedence order row in this Complete Cascading Order table? Or would it be more correct to add a fourth column to the ID-CLASS-TYPE ...
joseville's user avatar
  • 973

15 30 50 per page
1
2 3 4 5
25