All Questions
Tagged with css-specificity javascript
15 questions
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
126
views
CSS Specificity Counter
So the CSS specificity rules dictate that ids are the most powerful, then classes, then tag names and then *.
So #id > .class > div > *.
What I'm trying to do is get a 'rating' for each if I ...
0
votes
0
answers
75
views
how to override element class with group class
I'm newbie in web, I'm creating draganddrop function in svg canvas, where I have a group of several svg elements. While dragging I want to override classes of elements with class of group. But ...
1
vote
1
answer
96
views
Is there another way to add "hover" effect without !important after JS has set a value?
Learning website development (HTML, CSS, JS, PHP, yadda yadda). I am trying to create a hover effect on an element via CSS, however after a JS function has set a value, it seems I cannot override ...
4
votes
3
answers
549
views
CSS specificity when Javascript modifies CSS?
What is the CSS specificity when Javascript modifies CSS?
Such as:
document.getElementById("demo").style.color = "red";
Is it considered inline styling?
1
vote
1
answer
350
views
Use javascript to write CSS specificity function
I need to write a javascript function, which compares two arguments passed in. They will be strings. And represent CSS classes.
The aim of the function, is to weight CSS specificity. So if an ...
3
votes
1
answer
3k
views
Are there any CSS rules that, when set to empty strings, override lower-specificity rules
I'm trying to determine which style applies to an element by taking into account both inline and class styles. Javascript parses both of these into objects, but styles that are not set are empty ...
1
vote
2
answers
2k
views
CSS specificity beat inline with !important
Here is my site: http://stage.samkeddy.com/
It's responsive using a couple media queries and a mobile menu button powered by javascript.
Here is the javascript for the menu button:
function ...
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 ...
0
votes
2
answers
754
views
Why CSS .addClass is not applying proper style per specificity?
I understand the concept of css specificity.
Here is my situation:
I have a style for class called "success". This simply makes colors green...etc.
Now I have 2 separate css files that defines ....
1
vote
2
answers
281
views
Is there an JS library that orders CSS selector texts according to specificity? [duplicate]
Possible Duplicate:
Sorting a set of CSS selectors on the basis of specificity
I need a JS library that order CSS selector texts from most specific selector text to the less specific selector text,...
1
vote
0
answers
79
views
find out specificity of a css selector in javascript [duplicate]
Possible Duplicate:
Sorting a set of CSS selectors on the basis of specificity
does anyone know of a way to find out the specificity of a css selector in javascript? is there some library or maybe ...
6
votes
2
answers
345
views
Order CSS based on Selector Specificity
I have parsed a given CSS file/string into a JSON object like so:
{
"#header": {
"color": "#000000"
},
"#header h1": {
"color": "#000"
},
"h1": {
"color": "...
7
votes
6
answers
3k
views
text-decoration:none doesn't remove text decoration
Consider the following code
HTML:
<span class='c1'>Home<sup id='id1'>[2]</sup></span>
CSS:
.c1
{
text-decoration:underline;
}
#id1
{
text-decoration:none !important;
...
5
votes
1
answer
2k
views
Sorting a set of CSS selectors on the basis of specificity
How can a set of CSS selectors be sorted on the basis of CSS specificity in a JS function?
function SortByCssSpecificity(input_array_of_css_selectors) {
...
return sorted_array_of_css_selectors;
}...