简体   繁体   English

CSS不改变文字颜色?

[英]CSS not changing text color?

I've looked around for answers to this question, and I haven't been able to find any. 我一直在寻找有关此问题的答案,但至今没有找到任何答案。 I'm trying to change the color of the text of my description. 我正在尝试更改说明文字的颜色。 I have the following CSS: 我有以下CSS:

.description {
position:fixed;
overflow:auto;
width:200px;
height:130px;
margin-left:115px;
margin-top:235px;
border-bottom-left-radius:15px;
border-bottom-right-radius:15px;
opacity:1;
text-align:center;
font-family:'calibri';
font-size:10px;
color:{color:Title};
background-color:{color:border};
z-index:1;
}

And the corresponding div stuff (sorry, I'm not that good with the lingo yet.) 和相应的div内容(对不起,我对行话还没那么了解。)

<div class="description">
{block:Description}<div class="text">{Description}</div>{/block:Description}</div>

Now, the border color is #8f8f8f and the title color is #ffffff at the moment. 现在,边框颜色为#8f8f8f,标题颜色为#ffffff。 However, the text color is showing up as the border color instead of the title color. 但是,文本颜色显示为边框颜色而不是标题颜色。 If I change the background-color to something else (for example, the background color), the text color stays #8f8f8f. 如果我将background-color更改为其他background-color (例如,背景颜色),则文本颜色保持为#8f8f8f。 I've also tried making a whole new thing dedicated to description color in the meta name section at the top, as well as changing it from {color:Title} to something like {color:background} or similar things to that. 我还尝试过在顶部的元名称部分中创建一个专门用于描述颜色的全新事物,并将其从{color:Title}更改为类似{color:background}东西或类似的东西。

What I would like to know is: why is the text color not showing up as the title color, and how can I fix this? 我想知道的是:为什么文本颜色没有显示为标题颜色,我该如何解决?

Thanks to anybody who helps. 感谢任何帮助的人。

Recheck your code. 重新检查您的代码。 Your Meta Tag should look something like this: 您的元标记应如下所示:

 <meta name="color:title" content="#ffffff"/>

And then your CSS should be: 然后您的CSS应该是:

.description {
  position:fixed;
  overflow:auto;
  width:200px;
  height:130px;
  margin-left:115px;
  margin-top:235px;
  border-bottom-left-radius:15px;
  border-bottom-right-radius:15px;
  opacity:1;
  text-align:center;
  font-family:'calibri';
  font-size:10px;
  color:{color:title};
  background-color:{color:border};
  z-index:1;
}

And then you have the text wrapped in another class named text. 然后,将文本包装在另一个名为text的类中。 See yourself: 见自己:

<div class="description">
 {block:Description}<div class="text">{Description}</div>{/block:Description}
</div>

So Text that gets filled in with the {Description} variable will have the class "text" applied to it. 因此,用{Description}变量填充的Text将会应用“ text”类。 That overwrites the styles from the "description" before that, because it follows it. 这会覆盖之前的“描述”中的样式,因为它紧随其后。 So if there's a .text class in you CSS and there's "color: whatever" in this, that will overwrite your color from ".description" in this case. 因此,如果CSS中有一个.text类,并且其中包含“ color:what”,那么在这种情况下,它将覆盖“ .description”中的颜色。

So in your CSS there should also be: 因此,在您的CSS中还应该有:

.text {
      color:{color:title};
}

If you want all text inside an element with the class="text" to have that text color. 如果要使元素内具有class =“ text”的所有文本具有该文本颜色。 Element could be 元素可能是

<div class="text">XYZ</div> 

for example. 例如。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM