CSS没有显示在Inspect Element中? [英] CSS isn't showing up in Inspect Element?

查看:53
本文介绍了CSS没有显示在Inspect Element中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这就是CSS的样子

So this is what the CSS SHOULD look like

  h1{
    font-family:monospace;
}

.main{
    border: solid #000000 0.1px;
    background:rgba(255,255,255,0.3);
}

这就是我在Chrome中的Inspect元素中显示的内容

And this is what shows up in my Inspect Element in Chrome

element.style {
}
user agent stylesheet
html {
    display: block;
}

推荐答案

好的,可能有很多地方可能出错,但我认为最可能的是两个:

Ok, there may be many things that could go wrong but I think the most probable are two:

  1. 您的浏览器正在从缓存加载CSS.一种测试方法是向元素添加内联css.如果它加载了,但是对您的css文件所做的更改却没有,那么您可能要检查的是.htaccess中是否有Expires标头.无论如何,要检查是否是这种情况,首先要做的就是打开您的Chrome开发者工具,转到网络"标签,选中禁用缓存"选项并刷新页面.

  1. Your browser is loading the CSS from cache. One way to test this is to add inline css to the element. If it loads, but the changes to your css file don't then what you might check is if there are Expires headers in your .htaccess. In any case the first thing you can do to check if this is the case is to open your Chrome developer tools, go to the Network tab, check the Disable cache option and refresh the page.

如果先前的观察未能解决问题,则您可能应该检查CSS,这可能是错误地编写的,在不适用的媒体查询中,或者某些分号在文本之间被隐藏了.线.发生了.

If the problem doesn't get fixed with the previous observation you should probably check your CSS, something might be incorrectly written, in a media query that doesn't apply or maybe some semicolon got wild and hid between the lines. It happens.

这篇关于CSS没有显示在Inspect Element中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆