如何使用 HTML 引用外部 CSS
使用 HTML 引用外部 CSS 是一种常见做法,可以将样式规则与 HTML 文档分开,从而实现更简洁、可维护的代码。以下是如何在 HTML 中引用外部 CSS:
1. 创建 CSS 文件
首先,创建一个包含样式规则的 CSS 文件。例如,可以使用名为 style.<a style="color:#f60; text-decoration:underline;" href="https://www.php.cn/zt/15716.html" target="_blank">css</a>
的文件,其中包含以下内容:
<code class="css">body { font-family: Arial, sans-serif; font-size: 16px; } h1 { color: blue; }