【问题标题】:The color of my text won't change even though I put it in the code即使我将其放入代码中,文本的颜色也不会改变
【发布时间】:2013-12-19 00:26:40
【问题描述】:

我有一个带有以下代码的 H2:

<h2>
    From Me
</h2>

当我尝试使用以下 CSS 设置样式时,它不会变为深绿色 (#006400)。

h2{
    font-family: Arial, Helvetica, sans-serif;
    color: #006400
    font-weight: bold;
    font-size: 30px
    padding: 20px;
}

这不起作用的任何原因?

谢谢!

【问题讨论】:

  • 为什么不使用 firebug 或 chrome inspec element 或 IE 的 F12 来检查。

标签: css fonts colors


【解决方案1】:

color后面没有加“分号”。

改变

color: #006400 font-weight: bold;

color: #006400;font-weight: bold;

DEMO

【讨论】:

    【解决方案2】:

    看起来您只是缺少几个分号。

    试试这个

    h2 { font-family: Arial, Helvetica, sans-serif; color: #006400; font-weight: bold; font-size: 30px; padding: 20px; }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多