DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> CSS入門知識 >> CSS詳解
用表格做出直觀的英文顏色名稱對照表
編輯:CSS詳解     

寫網頁時最常見的困擾之一,就是想不起某個顏色的英文名稱。這個範例用一張彩色表格,把常見的顏色名稱(如 red、green、blue、magenta、yellow 等)以各自的實際色彩當作底色,並搭配高對比度的文字顏色顯示名稱,做成一張一目了然、可以隨查隨用的對照表。

設計巧思

每個格子都用 bgcolor 填入該色名對應的顏色,再依底色深淺挑選黑字或黃字,確保名稱清晰可讀。由於全部使用標準 HTML 表格,任何瀏覽器都能正確顯示,很適合作為設計或教學時的參考圖卡。

<html>
<head>
<title>顏色英文代碼對照表</title>
<style type="text/css">
.lu { font: 9pt "宋體"; }
body { margin:0; }
</style>
</head>
<body bgcolor="#fef4d9">
<br>
<center><font color=red size=6>顏色英文代碼對照表</font></center>
<br>
<center>
<table border=1 cellpadding=3 width=361>
  <tr>
    <td align=center bgcolor=red><font color="#FFFF00">red</font></td>
    <td align=center bgcolor=green><font color="#000000">green</font></td>
    <td align=center bgcolor=blue><font color="#FFFF00">blue</font></td>
    <td align=center bgcolor=magenta><font color="#FFFF00">magenta</font></td>
    <td align=center bgcolor=yellow><font color="#000000">yellow</font></td>
    <td align=center bgcolor=chocolate><font color="#000000">chocolate</font></td>
  </tr>
  <tr>
    <td align=center bgcolor=black><font color="#FFFF00">black</font></td>
    <td align=center bgcolor=aquamarine><font color="#000000">aquamarine</font></td>
    <td align=center bgcolor=lime><font color="#000000">lime</font></td>
    <td align=center bgcolor=fuchsia><font color="#FFFF00">fuchsia</font></td>
    <td align=center bgcolor=orange><font color="#000000">orange</font></td>
    <td align=center bgcolor=purple><font color="#FFFF00">purple</font></td>
  </tr>
</table>
</center>
</body>
</html>

想擴充更多顏色,只要照著格式增加列與欄即可。若偏好更精確的控制,也可以把 bgcolor 換成十六進位色碼(如 #1E90FF),就能收錄 CSS 完整的命名色與自訂色。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved