1

How can I get all CSS of an element and its children? I tried some Chrome extensions such as SnappSnippet, CssSteal but they don't work at responsive styles. They give the CSS which is only for that current resolution. I mean, let's say my codes are like this:

.example {
    color: red;
}

.box {
    color: black;
}

@media only screen and (max-width: 600px) {
    .example {
        color: blue;
    }
    .box {
        color: orange;
    }
}
<div class="example">
 <div class="box">...</div>
</div>

when I used the extensions, they return only:

.example{ color:red; }
.box{ color:black; }

How can I do this with javascript? or Is there another chrome extension you recommend to me?

edit// I solved the problem by using the "cssRules" function.

jack j.
  • 53
  • 1
  • 5
  • I think jquery can fetch css which will be applied at the time you execute the query. So if you are on the screen less than 600px, the other css inside media query will be applied.and then you can get them too using jquery. – Himanshu Upadhyay May 31 '18 at 11:08
  • 2
    Show us what you've tried, and what doesn't work. This is a wrong site if you're looking for chrome extension recommendations or someone to write code for you. – Adrian May 31 '18 at 11:08
  • Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it. – AndrewL64 May 31 '18 at 11:09
  • I think the easy way is that you try to save the page offline & then use Notepad++ to search in files. Use the selector as the search keyword. Then it will show you anywhere the selector show up – Toan Lu May 31 '18 at 11:10
  • I answered to a close question recently. You may want to see it, here: https://stackoverflow.com/questions/50567761/how-to-display-all-css-selectors-properties-in-a-textarea/50569764#50569764 – Takit Isy May 31 '18 at 11:47
  • It didn't work, unfortunately. – jack j. May 31 '18 at 15:01

0 Answers0