首页 > 解决方案 > 如何更改代码中已经定义的 css 样式?

问题描述

我有一个代码,代码中有类和 css 样式。我看不到也无法更改此 CSS 代码。所以我的 css 不适用于这个跨度。但是我需要根据需要更改这种 css 样式。我需要蓝色作为跨度。我怎么能这样做?尽快帮助我。谢谢。

.grid {
  display: block;
}

.grid .item {
  color: blue;
}
<div class="grid">
  <p>I need change</p>
  <span class="item" style="color:red;">This is change place!!!</span>
</div>

标签: htmlcss

解决方案


使用 !important 标签

.grid .item { color: blue !important; }

推荐阅读