Regarding html rgb color

I have a question regarding html color code.

<font color=rgb(255,0,0)> This is my font </font>

not showing red color fonts in firefox though the color code is fine. Any idea? Instead it is showing some weird green gray color!

Thanks


试试“风格”。

<font style="color: rgb(255,0,0)"> This is my font </font>

The syntax rgb(255,0,0) is not HTML and you are encountering error recovery. It is defined in the CSS colors spec. You can only use it in CSS.

Aside from that, the color attribute and the rest of the <font> element have been removed from HTML.

Use a stylesheet and a semantically appropriate element.

p {
  color: rgb(255, 0, 0);
}
<p>This is my font</p>

I think something has to be added to this. You shouldn't use the HTML <font> tag. It's deprecated, it's not supported by HTML5 and it has a weird behavior such as the one already displayed when you tried to go rgb(255,0,0) and the browser painted your font dark green.

Go with any of the text tags such as <span> , or <p> or whatever. And for the color, use the style attribute:

<span style="color:rgb(255,0,0);">This is my font</span>

Docs regarding <font> http://www.w3schools.com/html/html_styles.asp

链接地址: http://www.djcxy.com/p/2524.html

上一篇: 十六进制色码多个#

下一篇: 关于html rgb颜色