如何在 HTML 中更改元素的文字顏色?


使用 HTML 中的color 屬性顯示文字顏色。

注意 − 此屬性在 HTML5 中不受支援。

示例

你可以嘗試執行以下程式碼來了解如何在 HTML 中實現color 屬性 −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Background Colors</title>
   </head>
   <body>
      <table width = "100%">
         <tr>
            <td>
               <p><font color="blue">This is demo text.</font></p>
            </td>
         </tr>
      </table>
   </body>
</html>

更新於: 2020-06-24

8K 以上的瀏覽量

開啟你的 職業

完成此課程以獲取認證

開始學習
廣告