摘要: 为选择器添加一些特殊效果或者进行约束 1.当需要选中ul中的第一个元素时 <ul> <li>aaa</li> <li>bbb</li> <li>ccc</li> </ul> ul li:first-child{ background: red; } 2.当需要选中ul中的最后一个元素时 ul li: 阅读全文
posted @ 2020-10-16 18:19 null_lii 阅读(151) 评论(0) 推荐(0)
摘要: 1.后代选择器 body h1{ background: red; } 选择body下的所有h1标签并设定属性 2.子选择器 body>h1{ background: aqua; } 选择body下的最外层所属的所有h1并设定属性 3.相邻兄弟选择器 .a1 +h1{ background: aqu 阅读全文
posted @ 2020-10-16 17:42 null_lii 阅读(126) 评论(0) 推荐(0)
摘要: 1.标签选择器 <style> h1{ color: red; } </style> 更改所有标签 2.类选择器 <h1 class="a1">text</h1> <h1 class="a1">text1</h1> <style> .a1{ color: antiquewhite; } </styl 阅读全文
posted @ 2020-10-16 17:13 null_lii 阅读(137) 评论(0) 推荐(0)
摘要: 1.行内样式 <h1 style="color:red">行内样式<h1> 2.内部样式 在html的<head>中写明 <style> h1{ color: red; } </style> 3.外部样式(导入式) 新建stylesheet文件写明 h1{ color: red; } 然后在<hea 阅读全文
posted @ 2020-10-16 16:54 null_lii 阅读(93) 评论(0) 推荐(0)