我如何更改 HTML 的这两行,以便我可以将其放入我的 CSS?

How can I change this 2 lines of HTML so that i can put it into my CSS?

如何定位 CSS 中的红色文本?我需要将所有红色文本的颜色更改为橙​​色:

<span style="color: #dc143c;"><strong>Red text that must be Orange</strong></span>

我试过下面的方法,但我真的不知道我应该怎么写才能让它工作..

span[style="color: #dc143c;"] {
    color:#f7941d !important;
}

感谢您的帮助!

将所有红色代码放在 <span> 标签中,然后在 css 中定位 <span> 并给他们 class 标签将其颜色更改为下面给出的红色代码

<span class="red-text">this is red text</span>

css代码:

.red-text {color:#f7941d;}

我认为使用 class 或 id 作为跨度并在需要时使用 javascript 或 jquery 定位它会更容易。例子

红色文字必须是橙色

与 jquery 你可以这样做: $('.OrangeRedSpan').css('color': #FE9A2E);

为您的红色文本提供 ID 或 Class 颜色变化等

<span class="color-change" style="color: #dc143c;"><strong>Red text that must be Orange</strong></span>

现在在你的 css

.color-change {
    color:#f7941d !important;
    }

还有一点不要使用内联 css 因为如果使用内联 css 则内联 css 具有最高优先级 css 必须使用 !important 关键字来更改颜色。

您应该从 html 中完全删除样式标签并改用 classes。

<span class="colored"><strong>colored text</strong></span>

然后 select css 中的 class 改为

.colored {
  color: orange;
}
  <span id="change">this is red text</span>

css代码:

  #change {
 color:#f7941d;
 }

试试这个希望对你有帮助

在强标签处添加class橙色:

<span style="color: #dc143c;"><strong class="orange">Red text that must be Orange</strong></span>

在 .css 文件中:

.orange {

颜色:#f7941d!重要; }