【问题标题】:Firefox wont show colors, IE shows correctFirefox 不显示颜色,IE 显示正确
【发布时间】:2015-04-05 14:38:51
【问题描述】:

我只是 CSS 的初学者,所以我有一个问题我写了一个简单的代码,IE 显示正确,但是 Firefox 没有,我该如何解决这个问题?代码有什么问题?谢谢你。正如我所说,我是初学者,很抱歉提出愚蠢的问题。 :) 这是代码

h3 {
  color: "blue";
  font-size: "20px";
  font-family: "verdana"
}
p {
  color: "white";
  background: "blue";
  font-family: "helvetica";
  text-indent: "1 cm"
}
<html>

<head>
  <title>Pakopinių stilių (CSS) naudojimo pavyzdys</title>
  <link rel="stylesheet" href="stiliai.css" type="text/css">
</head>

<body>
  <h3>Trečiojo lygio antraštė</h3>
  <p>Naujas pastraipų stilius.</p>
</body>

</html>

首先是CSS我叫stiliai.css,其次是html叫index.html

【问题讨论】:

  • 您不需要在css值中添加双引号,即color: blue;很好,因为字体只有在名称内部有间隙时才使用它,即font-family: "helvetica neue";well,这可能不是与您的上述问题有关。
  • 谢谢,现在可以正常使用了。

标签: html css internet-explorer firefox colors


【解决方案1】:

删除包裹颜色的引号。指定颜色时不需要引号。

改变

h3 {color:"blue"; font-size:"20px"; font-family: "verdana"}

to 

h3 {color:blue; font-size:"20px"; font-family: "verdana"}

【讨论】:

  • @netycia:也删除字体大小周围的引号。字体名称通常也不需要它们。
  • 所以根本不需要引号?
  • 对于指定颜色,它们不是必需的。即使您使用 #ffffff 之类的颜色代码
【解决方案2】:

您的问题在于您在 CSS 中使用 "。这些是不需要

h3 {
  color: blue;
  font-size:20px;
  font-family: verdana
}
p {
  color: white;
  background: blue;
  font-family: helvetica;
  text-indent: 10px; /*cm are not commonly used in css*/
}
<html>

<head>
  <title>Pakopinių stilių (CSS) naudojimo pavyzdys</title>
  <link rel="stylesheet" href="stiliai.css" type="text/css">
</head>

<body>
  <h3>Trečiojo lygio antraštė</h3>
  <p>Naujas pastraipų stilius.</p>
</body>

</html>

只有在使用 html 之类的内容时,才需要使用 "

它们不用于 css 文件

【讨论】:

猜你喜欢
  • 2012-08-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-08
  • 2015-11-23
  • 1970-01-01
  • 1970-01-01
  • 2015-11-03
相关资源
最近更新 更多