HTML 的颜色表示可分两种:
● 以命名方式定义常用的颜色,如 RED。
● 以 RGB 值表示,如 #FF0000 表示 red。
命名方式涵括的色种不多亦不甚方便,较少采用,以下介绍 RGB 值的原理:
众所皆知颜色是由 "red" "green" "blue" 三原色组合而成的,在 HTML 中对於彩度的定义是 采十六进位的,对於三原色 HTML 分别给予两个十六进位去定义,也就是每个原色可有 256 种彩度,故此三原色可混合成一千六佰多万的颜色。
例如
白色的组成是 red=ff, green=ff, blue=ff, RGB 值即为 ffffff
红色的组成是 red=ff, green=00, blue=00, RGB 值即为 ff0000
绿色的组成是 red=00, green=ff, blue=00, RGB 值即为 00ff00
蓝色的组成是 red=00, green=00, blue=ff, RGB 值即为 0000ff
黑色的组成是 red=00, green=00, blue=00, RGB 值即为 000000
於应用时常在每个 RGB 值之前加上符号 # 以示分别,但不加亦可。
■ HTML 基本架构:
选按不同颜色按键以测试前景颜色效果 (只适合 Internet Explorer) 选按不同颜色按键以测试背景颜色效果 或输入一个 RGB 颜色码或名称
■ 16 常用颜色表:
ColorValueName ColorValueName #00FFFFaqua #808080gray #000080navy #C0C0C0silver #000000black #008000green #808000olive #008080teal #0000FFblue #00FF00lime #800080purple #FFFF00yellow #FF00FFfuchsia #800000maroon #FF0000red #FFFFFFwhite
■ 其它常用颜色表:
ColorValueName ColorValueName #F0F8FFaliceblue #A00000antiquewith #7FFFD4aquamarine #F0FFFFazure #F5F5DCbeige #FFE4C4bisque #000000black #FFEBCDblanchedalmond #0000FFblue #8A2BE2blueviolet #A52A2Abrown #DEB887burlywood #5F9EA0cadetblue #7FFF00chartreuse #D2691Echocolate #FF7F50coral #C0F000cornfloewrblue #FFF8DCcornsilk #00FFFFcyan #00008Bdarkblue #008B8Bdarkcyan #B8860Bdarkgoldenrod #A9A9A9darkgray #006400darkgreen #DA0000darkhaki #8B008Bdarkmagenta #556B2Fdarkolivegreen #DA000Edarkorenge #9932CCdarkorchid #8B0000darkred #E9967Adarksalmon #8FBC8Fdarkseagreen #483D8Bdarkslateblue #2F4F4Fdarkslategray #00CED1darkturquoise #9400D3darkviolet #FF1493deeppink #00BFFFdeepskyblue #696969dimgray #1E90FFdodgerblue #B22222firebrick #FFFAF0floralwhite #228B22forestgreen #DCDCDCgainsboro #00000Egostwhite #FFD700gold #00E00Dgolenrod #808080gray #008000green #ADFF2Fgreenyellow #F0FFF0honeydew #FF69B4hotpink #CD5C5Cindianred #FFFFF0ivory #F0E68Ckhaki #E6E6FAlavender #FFF0F5lavenderblush #7CFC00lawngreen #FFFACDlemonchiffon #ADD8E6lightblue #F08080lightcoral #E0FFFFlightcyan #0000E0lightgodenrod #0000E0lightgodenrodyellow #0000A0lightgray #90EE90lightgreen #FFB6C1lightpink #FFA07Alightsalmon #20B2AAlightseagreen #87CEFAlightskyblue #0000EBlightslateblue #778899lightslategray #B0C4DElightsteelblue #FFFFE0lightyellow #32CD32limegreen #FAF0E6linen #FF00FFmagenta #800000maroon #66CDAAmediumaquamarine #0000CDmediumblue #BA55D3mediumorchid #ED0000mediumpurpul #3CB371mediumseagreen #7B68EEmediumslateblue #00FA9Amediumspringgreen #48D1CCmediumturquoise #C71585mediumvioletred #191970midnightblue #F5FFFAmintcream #FFE4E1mistyrose #FFE4B5moccasin #FFDEADnavajowhite #000080navy #A0B0E0navyblue #FDF5E6oldlace #6B8E23olivedrab #FFA500orange #0E0EEDorengered #DA70D6orchid #A00D00palegodenrod #98FB98palegreen #AFEEEEpaleturquoise #DB7093palevioletred #FFEFD5papayawhip #FFDAB9peachpuff #CD853Fperu #FFC0CBpink #DDA0DDplum #B0E0E6powderblue #800080purple #FF0000red #BC8F8Frosybrown #4169E1royalblue #8B4513saddlebrown #FA8072salmon #F4A460sandybrown #2E8B57seagreen #FFF5EEseashell #A0522Dsienna #87CEEBskyblue #6A5ACDslateblue #708090slategray #FFFAFAsnow #00FF7Fspringgreen #4682B4steelblue #D2B48Ctan #D8BFD8thistle #FF6347tomato #40E0D0turquoise #EE82EEviolet #00E0EDvioletred #F5DEB3wheat #000E00hite #F5F5F5whitesmoke #FFFF00yellow