All Questions
Tagged with css-specificity css-selectors
140 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 ...
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 ...
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 {
...
....
2
votes
2
answers
728
views
How to increase priority without using !important?
How do I get rid of the !important tag in the following example?
<html><head><style>
.class1.class2::after {
content: ".class1.class2";
}
.class3::after {
content: ...
1
vote
2
answers
59
views
CSS Specificity - Conflicts between CSS selectors
I have a question regarding the following pseudo-class selector.
Even with !important, the text under this li:first-child is not showing blue.
p has Selector Specificity: (0, 0, 1)
li:first-child has ...
0
votes
1
answer
753
views
Stylelint selector-max-specificity: class::placeholder (0,0,1) doesn't but class:focus::placeholder (0,1,1) throws error with 0.2.0 max specificity
I am trying to reduce CSS specificity in my project by using the stylelint selector-max-specificity and I have now set it to "0.2.0". The problem is that when I use wonderful-input::...
0
votes
2
answers
487
views
I want to add a border to the same styled element with a seperate css class
I want to be able to add a border with javascript. So I thought I could do it with adding it as a seperate class . But it does not work .
#button1 {
box-shadow:inset 0px 0px 0px 0px #3dc21b;
...
0
votes
1
answer
20
views
Rules Specificity [duplicate]
body {
font-size: 12px;
}
.brown {
color: brown;
font-weight: 200;
}
.large {
font-size: 28px;
}
.normal {
font-size: 18px;
color: blue;
font-weight: 700;
}
<html>
<head&...
0
votes
0
answers
22
views
CSS Selector Specificity comparison between elements and class [duplicate]
I am trying to figure out how the specificity works in case of css. Below you can find a deeply nested div class. I am trying to style the last nested div element using div as well as class. The ...
1
vote
2
answers
855
views
Can't change the style of link
I'm very new to coding and I currently try to change the style of my html link.
I've nested my Picture, <h1> and <p> in a <a href> to make it all a link to the same destination, but ...
0
votes
0
answers
16
views
How is css specificity determined for elements with the same selector? [duplicate]
I have two styles affecting the same element (myDiv) from different stylesheets.
Stylesheet1.css
.myDiv{
background-color:#000;
}
Stylesheet2.css
.myDiv{
background-color:#FFF;
}
Neither style ...
0
votes
1
answer
40
views
Am I messing with specificity ? What's going on?
I will short and clear. I have this html code snippet.
<nav>
<span class="heading"><a href="#">CodingHero</a></span>
<ul>
...
0
votes
2
answers
2k
views
CSS: Selector for Google's search box
I am trying to make Google's homepage more to my liking. I have added the following CSS:
* {
/* zoom: */
/* font-size: 103% ; */
min-width: 0px !important ;
}
input {
width: 1000px !...