使用CSS更改选定的文本颜色

时间:2018-08-20 12:11:23

标签: css wordpress

早上好,我在尝试弄清楚如何更改句子中的特定文本时遇到了一些困难。

我有以下文字:

欢迎来到最强传奇》

我在代码中拥有什么

<h1 style="text-align: center;"><strong>  Welcome to Strongest Legend </strong></h1>

所以我尝试将to的代码更改为以下内容:

<h1 style="text-align: center;"><strong>  Welcome to Strongest</strong></h1><h1 id="legend"><strong> Legend </strong></h1>

我安装了一个名为Custom CSS的插件,我在其中放置了所有的CSS代码,我尝试通过其ID编辑“传奇”,但是它不起作用。

有人可以解释我在做什么错吗?

我希望以下CSS代码生效。

.legend {
 color: #5E5E5E; 
}

我在外观->自定义CSS中发布了它。

对不起,我忘了禁止在SO上发布链接。

2 个答案:

答案 0 :(得分:2)

使用 #legend ,而不使用 .legend

  

您使用的是Id not class

答案 1 :(得分:0)

您的代码就是这样

<h1 style="text-align: center;"><strong>  Welcome to Strongest</strong></h1><h1 id="legend"><strong> Legend </strong></h1>

现在,您像这样应用CSS,

h1#legend {
  color: #5E5E5E;
 }

谢谢!

相关问题