多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## color 属性 ### 属性定义及使用说明 Color属性指定文本的颜色。 JavaScript 语法:object.style.color="#FF0000" * * * ## 提示和注释 **提示**:请使用合理的背景颜色和文本颜色搭配,这样可以提高文本的可读性。 * * * ## Property Values | 值 | 描述 | | --- | --- | | *color\_name* | 规定颜色值为颜色名称的颜色(比如 red)。 | | *hex\_number* | 规定颜色值为十六进制值的颜色(比如 #ff0000)。 | | *rgb\_number* | 规定颜色值为 rgb 代码的颜色(比如 rgb(255,0,0))。 | | inherit | 规定应该从父元素继承颜色。 | * * * ## 实例--不同元素设置text-color: ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>W3Cschool教程(w3cschool.cn)</title> <style> body {color:red;} h1 {color:#00ff00;} p.ex {color:rgb(0,0,255);} </style> </head> <body> <h1>This is heading 1</h1> <p>This is an ordinary paragraph. Notice that this text is red. The default text-color for a page is defined in the body selector.</p> <p class="ex">This is a paragraph with class="ex". This text is blue.</p> </body> </html> ```