HTML 颜色style的五种设置方法

方法一、内嵌样式表

<style>
h1 {
      
      color: pink;}
</style>
<h1>The color is pink!</h1>

方法二、内联样式

<h1 style="color: gold;">The color is gold!</p>

方法三、使用id或class引入

<style>
.grn {
      
      color: green;}
</style>
<h1 id="grn">The color is green!</h1>

方法四、外部样式表

<link rel="stylesheet" href="./style.css">
<h1>The color is orange!</h1>

style.css

h1 {color: orange;}

方法五、导入样式表

<link rel="stylesheet" href="./style.css">
<h1>The color is white!</h1>

style.css

@import "1.css";
@import "2.css";

1.css

h1 {color: white;}

猜你喜欢

转载自blog.csdn.net/weixin_46119529/article/details/130953139