ChatGPT解决这个技术问题 Extra ChatGPT

Google Chrome Dev Tools inspect element styles not showing

Starting a couple of weeks ago....on some of our sites, but not all, when inspecting an element, the styles tab only shows the "styles box", but not the actual styles relating to css?? - Again, this is ONLY on some sites - weird

It should look like this (with styles showing on the right relating to css)

https://i.stack.imgur.com/K6JIA.png

BUT......instead, on SOME of our sites, this just started a couple of weeks ago looking like this....with no css showing in the styles tab:

https://i.stack.imgur.com/q5k3U.png

NOTE: it has worked for 2 years - The page looks fine and all styles are being applied to the DOM, but do NOT show up in the styles tab when inspecting element.

Any ideas??

Check once and confirm that class or id which you are inspecting is exist in the loaded CSS file or internal styles.
It is - again, nothing is "new" about our site - it has worked for 2 years - the page looks fine and all styles are being applied to the DOM....they just don't show up on the styles tab anymore
then it is really weird.
It happens on website per basis. Some sites show the styles and some not. Well resetting developer tool works.
Did you ever figure this one out? I've been through all the suggested answers and none of them work. Weirdly it only happens in Chrome Canary

A
Andrea Black

I just had this same issue and to resolve it I went into Chrome Developer Tools -> Settings -> Scroll to the bottom and click "Restore defaults and reload" then it all magically came back!

I hadn't changed anything between it working and when it stopped so not sure why it broke but hopefully this helps you too.


This Answer still works. Thanks for the Informations and Guide so resolve this Problem
helped me too! I just created a new "Person" in Chrome to be able to disable all plugins ... and from the start, Styles was not visible. Restored the defaults and it's there. Funny enough, in the other browser window, where I was using my default user, it was there all the time.
p
pilau

I just close the tab, and reopen it, and then right click > inspect element. Don't need to restore the whole dev tools to default settings. It's a waste. Try it, it works! :)


worked for me too - can't believe it wouldn't be the first thing a fairly logical, sensible tech would do, but here I am browsing SE instead of just "turning the darn thing off and on again" I suppose
And with this solution, you don't even have to lose all your settings.
This works sometimes and only once, but soon the problem reappears for me. Using Chrome Version 54.0.2840.71 (64-bit)
@EduardoChongkan For me, it works all the time, but thank you for updating!
there are different problems. sometimes pressing F12 twice (no tab close) is enough...
P
Pratik Mandrekar

I had to go to Chrome Developer Tools -> Settings -> Enable JavaScript source maps and then disable that checkbox. It has probably got do with sourcemaps and the fact that I'm building the scss to css.


This worked for me for a local site that was having issues, thanks!
d
dandavis

something that worked for me: chrome:flags>Enable Developer Tools experiments>Disable. I had enabled it at some point, used it for years w/o issue, then could not see any style details as OP described. After updating, resetting devtools prefs to default, even trying incognito, this was the one thing that seemed to get it working again. There were some neat experiments, but i'd much rather be able to do my job...


R
Romeu

I was also facing this problem, in addition to the suggestions the other users made it worked for me accessing:

Chrome Developer Tools -> CSS -> Relaoad Linked Style Sheets

Image Ilustrating the procedure


P
PW Kad

I was just having the same odd issue. I'm not 100% sure what triggered this to happen but we use build tools to build SCSS into CSS. I went into my CSS file and removed the source map reference -

/*# sourceMappingURL=myCSS.map */

And all of the sudden it started showing up again. Then I added it back and I can still see it. I am not sure if this is because a version of the map is cached now or not but this worked for me.


G
Ganapati prasad

Even i faced this issue !!!

style.css file was causing this issue..

I just created a new css file (Ex: style1.css) and cut pasted the older css file content (all lines in style.css) to style1.css file. It works

Note: Don't forget to update link tag, which is loading css file.


N
Naren Yellavula

I think your CSS files are not loaded properly. Just check the syntax for referencing the external stylesheets.

It should be like this

<link rel="stylesheet" type="text/css" href="mystyle.css">

If you are skipping the rel="stylesheet", browser may think it as a plain file. To confirm the loading of stylesheets go for Chrome Inspector -> Sources

Check the site resources

No need of resetting anything. Hope it helps :)


S
Steen Hjalmar Larsen

I use Dreamweaver and Breckets. Could see that the problem occurred only when I used Dreamweaver. Solved the problem by changing Dreamweaver's preferences

--> Code Format --> Line Break Type --> CR LF (Windows)


S
Steve de Niese

Another one for the mix - using CSS variables but one of the variables was referencing another variable that didn't exist.

Elements using that missing variable in the chain just don't show up in chromium at all (it hid all references to h2s in the case of my site).

Interestingly, it still shows the elements in Firefox's dev tool panel.


W
Wellington

Look for errors in the CSS file, in my in my case it was on the global CSS variables, fixing the errors solved the problem.

This tool can help you find the errors: https://jigsaw.w3.org/css-validator/


Could you please be more specific as to how you fixed your problem?
S
Simon_Weaver

Sometimes it can be the server!

I just had this error on a page that appeared to be fully loaded but the style panel was completely empty.

A complete restart of Chrome (and verifying no processes) did not work.

Restarting my server (in this case a .NET Core app running locally in Visual Studio) then allowed the style panel to show.

I think there was some sort of connection leak or web socket limit - something of that nature which was confusing Chrome.


B
Badri Bashipangu

I think this may helpfull.. If it is an angular project > then simply run

ng serve --extract-css.