来中软学习的第三天

来源:互联网 发布:windows defender 打开 编辑:程序博客网 时间:2024/06/06 00:05

今天是1月14号,来中软已经是第三天了,在这三天的日子里,我复习了不少以前学过的知识,但同时也学会了些以前没有接触过得标签和选择器,尤其是选择器,有些选择器以前用过,但都只会使用却不知道到它到底叫什么,有什么优先级之类的认识。今天学的选择器过于多,有class类选择器如 .aa ,id选择器如 #id ,内联选择器如 style=“” ,标签选择器如 p,a,u等等,并集选择器 如 div.aa,子级选择器div aa,:nth-child( )选择器,里面填数字,什么数字就是选择那个标签的第几个进行样式修改。


ul li:nth-child(2n){color: green;} ul下li的属于偶数的元素变成绿色
ul li:nth-child(2n-1){color: red;}  ul下li属于奇数的元素变成红色

first-child{ }        第一行选择器
last-child{ }   最后一行选择器


h2{font-size: 20px;color:red;}                                  标签选择器
.one{font-size: 25px;color: blue;}                            类选择器
#two{font-size: 30px !important;color: yellow;}    id选择器


.dad>p{color: green;}     子代选择器

.box:before{content:"";display:block;width: 100px;height: 100px;background: blue;}  伪类选择器

0 0
原创粉丝点击