W3.CSS 中使用的默认配色方案的灵感来自 Material Design Colors(营销、路标和便签中使用的颜色)。
的W3-颜色和W3-文本的颜色类可用于着色任何HTML元素:
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
红色的
绿
蓝色
黄色
灰色的
黑色的
姓名 | 积分 |
---|---|
吉尔史密斯 | 50 |
伊芙·杰克逊 | 94 |
亚当约翰逊 | 67 |
汽车是一种用于运输的轮式、自供电机动车辆。该术语的大多数定义都指定汽车主要设计为在道路上行驶,可容纳 1 到 8 人,通常有四个轮子。(维基百科)
在W3-颜色类设置任何HTML元素的背景色:
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
<div class="w3-red"> <h2>London</h2> <p>London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.</p> </div> <div class="w3-yellow"> <h2>London</h2> <p>London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.</p> </div> <div class="w3-gray"> <h2>London</h2> <p>London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.</p> </div>
颜色灰色和灰色在所有W3.CSS类互换。
在W3-文本的颜色类别设置任何HTML元素的文本颜色:
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
<div class="w3-text-red"> <h2>London</h2> <p>London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.</p> </div>
的W3-hover-色类定义为任何HTML元素的背景悬停颜色:
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
<div class="w3-container w3-orange w3-hover-red"> <h2>London</h2> <p>London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.</p> </div>
在W3-悬停文本的颜色类定义的任何HTML元素的文本悬停颜色:
伦敦是英国人口最多的城市,大都市区人口超过 900 万。
<div class="w3-container w3-orange w3-hover-text-white"> <h2>London</h2> <p>London is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.</p> </div>
除了标准的 W3.CSS 颜色,W3.CSS 还可以使用来自许多不同颜色库的颜色:
在本教程后面的章节中,您将学到更多关于颜色的知识。