HTML-CSS cross-browser color issue

时间:2022-11-13 19:38:39

I am using the following CSS code within a html page in order to set the H1 and H2 color values.

我在html页面中使用以下CSS代码以设置H1和H2颜色值。

<style type="text/css">
img
{border-style: none;}
H1 {color: "#33CCFF"}
H2 {color: "#33CCFF"}
</style>

This is working fine for Internet explorer, but is failing for Chrome, Safari, and Firefox.

这适用于Internet Explorer,但Chrome,Safari和Firefox都失败了。

How do I fix this issue to support all browsers?

如何解决此问题以支持所有浏览器?

Thanks

2 个解决方案

#1


5  

you need remove '"' around color

你需要删除颜色周围的“”

  • ; goes at the end of the css declaration always, like this:
  • ;始终在css声明的末尾,如下所示:

H1 {color:#FFF;width:100%;} H1#ID.class {color:#FFF;width:100%;} <==== right order for combining ID's + Class

H1 {颜色:#FFF;宽度:100%;} H1#ID.class {颜色:#FFF;宽度:100%;} <====组合ID +类的正确顺序

#2


0  

You need to remove the quotes as Voodoo says, but you should also really be closing the color declaration with a semicolon (;). It may work without it, but you're really asking for trouble. ;)

你需要删除引号,如Voodoo所说,但你也应该用分号(;)来关闭颜色声明。没有它可能会有效,但你真的在寻找麻烦。 ;)

#1


5  

you need remove '"' around color

你需要删除颜色周围的“”

  • ; goes at the end of the css declaration always, like this:
  • ;始终在css声明的末尾,如下所示:

H1 {color:#FFF;width:100%;} H1#ID.class {color:#FFF;width:100%;} <==== right order for combining ID's + Class

H1 {颜色:#FFF;宽度:100%;} H1#ID.class {颜色:#FFF;宽度:100%;} <====组合ID +类的正确顺序

#2


0  

You need to remove the quotes as Voodoo says, but you should also really be closing the color declaration with a semicolon (;). It may work without it, but you're really asking for trouble. ;)

你需要删除引号,如Voodoo所说,但你也应该用分号(;)来关闭颜色声明。没有它可能会有效,但你真的在寻找麻烦。 ;)