371 questions
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 | ...
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
...
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 ...
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 ...
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 {
...
....
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>
...
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;
...
-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 ...
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 ...