我无法更改标签的字体颜色。我认为这与特异性有关,但是我无法做出任何进展来改变它。

这是代码:

<header class="header" id="top">
  <div class="text-vertical-center">
    <h1>Reclamar não muda</h1>
    <h3>Free Bootstrap Themes &amp; Templates</h3>
    <br>
    <a href="#about" class="btn btn-dark btn-lg js-scroll-trigger">Find Out More</a>
  </div>
</header>


显然,此代码嵌套在<html>和>标记内。这些是所显示的所有类和ID的各自的CSS:

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.header {
    position: relative;
    display: table;
    width: 100%;
    height: 100%;
    background: url(../img/bg2) no-repeat center center scroll;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

.text-vertical-center {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

.text-vertical-center h1 {
    font-size: 4.5em;
    font-weight: 700;
    margin: 0;
    padding: 0;
}

.about {
    padding: 50px 0;
}


当我尝试更改文本<body的颜色(使用葡萄牙语,如果您想知道的话)时,实际上是某种灰色阴影,则什么也没有发生。我尝试在Reclamar não muda css代码中输入font-color: whitefont-color:#ffffff,但是什么也没有发生。

顺便说一下,这些代码都是来自免费的引导程序代码。如果您需要更多代码来回答我的问题,请这样说,我们很乐意在此处输入它们。

最佳答案

问题在于,要更改颜色,您需要值color,而不是font-color。同样重要的是要注意,它必须使用美国拼写书写; colour也不起作用。

您正在寻找:

.text-vertical-center h1 {
  color: #ffffff;
}


这是一个有效的示例(黑色背景对此进行了演示):



html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.header {
  position: relative;
  display: table;
  width: 100%;
  height: 100%;
  background: black;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

.text-vertical-center {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}

.text-vertical-center h1 {
  font-size: 4.5em;
  font-weight: 700;
  margin: 0;
  padding: 0;
  color: #ffffff;
}

.about {
  padding: 50px 0;
}

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<header class="header" id="top">
  <div class="text-vertical-center">
    <h1>Reclamar não muda</h1>
    <h3>Free Bootstrap Themes &amp; Templates</h3>
    <br>
    <a href="#about" class="btn btn-dark btn-lg js-scroll-trigger">Find Out More</a>
  </div>
</header>





希望这可以帮助! :)

关于html - 什么定义了我的字体颜色?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46655142/

10-10 10:50
查看更多