<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- 外部样式表 -->
<link rel="stylesheet" href="https://juejin.cn/post/外部样式表.css">
<style>
/* 内部样式表 */
/* 三种常用的选择器 */
/* 标签选择器,直接打对应的标签名称 */
p{
color:red;
}
/* id选择器,#+id名称 */
/* id只能有一个,不可以重复 */
#text{
color:red;
}
/* 类选择器,.+class名称 */
/* class名称可以重复 */
.t1{
color:green;
}
/* 三种选择器的权重值:id选择器(100)>class选择器(10)>标签选择器(1) */
</style>
</head>
<body>
行内样式法:给指定的标签添加style属性
<p style="color:biue;font-size: 30px;">我是蓝色字</p>
<p id="text">我是红色字</p>
<p class="t1">我是绿色字</p>
</body>
</html>
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END