首页 > 文章列表 > 如何在HTML中更改元素的文本颜色?

如何在HTML中更改元素的文本颜色?

326 2023-09-13

使用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>