Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome developer tools some styles from CSS file grayed out/uneditable?

I found lots of questions regarding the grayed out styles in Chrome developer tools, but none that describes the strange behavior I have. I have plain class styles in a CSS file. For some reason I can edit one of them, but not the other:

CSS file:

.result {
    background-color: #000;
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 100;
}

.result_image {
    height: 80%;
    overflow: hidden;
}

.result_text {
    font-size: 13.6px;
    margin-left: 5px;
    font-weight: bold;
    height: 20%;
}

HTML:

<div class="result">
    <div class="result_image"><img src="..."></div>
    <div class="result_text">Some text</div>
</div>

As you can see in the screenshots, I can edit the div class="result_image", but not the div class="result_text". I think the problem has something to do with Chrome claiming that the grayed out style comes from a style-tag, but both styles are in the file "qb1.core.css".

This is the output for the div class="result_image"

This is the output for the div class="result_text"

like image 738
needfulthing Avatar asked Jul 05 '16 11:07

needfulthing


People also ask

Why is CSS grayed out?

@Rob To be precise, when a style is shown greyed out, it means it has been inherited from some other encompassing element but is not applicable to the selected element. From the documentation: "The pane contains only properties from rules that are directly applicable to the selected element.

How do I edit CSS in Chrome developer tools?

Press Ctrl + Shift + i for Windows/Linux (or command + option + i for Mac). Right-click on an element on your website page and select Inspect. Now that you are familiar with accessing Google Chrome Developer Tools, you will be able to inspect CSS elements to modify them live.

Why is my CSS not working in Chrome?

You may see that CSS is not working on Google Chrome, but it works on IE, Firefox, Edge, or any other browser. The reason can be the corrupted temporary data, different CSS encoding, and a third-party Chrome extension that utilizes CSS stylesheets.

How do I save CSS changes of styles panel of Chrome developer tools?

To save your changes, press CTRL + S when editing the file.


2 Answers

This happened to me without any iFrame. It turns out that there was a style in my stylesheet giving the background to a particles.js area an empty url. Basically, it said: background-image: url(''); - this was in a completely unrelated area of the css file, but as soon as I commented it out and refreshed the page I could edit the css from developer tools and it showed as coming from the css file, not from a style tag.

Another thing to point out is that when I observed the css file from the Sources tab the css file showed as completely empty. When I saw that, I was able to find the info about the empty url css rule at the following forum post https://groups.google.com/forum/#!topic/google-chrome-developer-tools/Z_TLvpOXrMg

like image 95
kilkfoe Avatar answered Sep 21 '22 00:09

kilkfoe


Ok, this seems to happen because my HTML/CSS is in an iframe and I only reload the iframe. When I hard-reload the whole page, the class is not grayed out anymore. Maybe Chrome loses the context, if some of the code comes from the cache.

like image 22
needfulthing Avatar answered Sep 20 '22 00:09

needfulthing