html - CSS按钮不会改变颜色
问题描述
我正在尝试通过更改一些颜色来编辑我在互联网上下载的模板。但是,当我更改 css 文件中的颜色时,它不会在网站上更改它:
HTML:
<div class="user-panel">
<a href="https://example.com" target="_blank">Link</a>
</div>
CSS:
.user-panel {
float: right;
font-weight: 500;
background: #ffb320;
padding: 8px 28px;
border-radius: 30px;
}
这就是我导入 .css 文件的方式:
<link rel="stylesheet" href="{% static 'css/style.css' %}"/>
所以我所做的就是#ffb320
用#cc0000
红色代替黄色,保存文件并重新加载页面,但颜色没有改变。字体大小等也是如此...
唯一有效的是使用style='font-size:20px'
字体大小。
我在这里做错了什么?
解决方案
发生这种情况是因为缓存所以,你可以这样做:
<link rel="stylesheet" href="{% static 'css/style.css' %}?version=55"/>
另外,请运行以下命令:
python manage.py collectstatic
推荐阅读
- javascript - 如何使用 jQuery 隐藏子页面?
- python - Kivy 标签仅显示文本循环的最后一个元素
- javascript - 使用打字稿反应热重载
- java - 我的 findViewByid 在扩展片段上变红,我在 onCreate 方法上做而不是在 onCreateView 方法中
- ip - 可以解除阿里ECS实例的公网IP绑定吗?
- getgauge - getaguge vscode 插件与 java 仪表项目
- java - 使用斯坦福解析器检测句子中的语法错误
- java - 在从 LinkedHashMap 中删除对象之前关闭对象是否安全?
- python - 条件语句在不同语言中的行为不同
- node.js - 大家好..我对这一切都很陌生..我在安装 npm 时遇到问题