我有一个可以使用的css链接到html。我试着在外部css文件中添加链接的样式,但没有成功。
.list-container li a, .list-container li a:hover {
text-decoration: none;
color: #fff;
}
html:
<ul class="list-container">
{% for skill in skills %}
<li style="--color: {{skill.color}};">
<a href="random.html">
<div class="card-content">
<h2>{{skill.name}}</h2>
<span>Master</span>
</div>
</a>
</li>
{% endfor %}
</ul>
我尝试了不同的变体,但这不起作用。然而内联样式确实有效。
<a style="text-decoration: none; color: white;" href="random.html">
但我希望在外部文件中能有更好的效果。我该怎么做呢?
我发现了为什么它不能工作。我的浏览器将外部的css文件保存在缓存中,因此更改没有通过。所以我清空了缓存,现在一切正常。