Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All 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; ...
navigation-bar's user avatar
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 ...
Riza Khan's user avatar
  • 3,170
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 ...
Reena Verma's user avatar
  • 1,685
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,...
einstein's user avatar
  • 13.9k
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": "...
Abs's user avatar
  • 58k
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; }...
Dev Sahoo's user avatar
  • 12.1k