CSS3 之选择器

文章目录

      • 1、关系性选择器:E+FE~F
      • 2、属性选择器
      • 3、伪元素选择器
      • 4、伪类选择器(被选中的元素的一个种状态)
      • calc

1、关系性选择器:E+FE~F

CSS3 之选择器_第1张图片

2、属性选择器

E[attr~=“val”]E[attr|=“val”]E[attr^=“val”]E[attr$=“val”]E[attr*=“val”]

CSS3 之选择器_第2张图片

3、伪元素选择器

E::placeholderE::selection
Div:nth-of-type(1)::selection{只能写三个属性color/background-color/text-shadow}

4、伪类选择器(被选中的元素的一个种状态)

CSS3 之选择器_第3张图片

eg:li:not(:last-of-type){
eg:li:not(:last-of-type){
 order-bottom:1pxsolidblack;
}
E:root===html

在这里插入图片描述

  • E:target

在这里插入图片描述

//eg:
a>
a>
div>
div>

css:div:target{
	border:1pxsolidblack;
}

  • E:first-childE:last-child

CSS3 之选择器_第4张图片

  • E:only-child
    E:nth-child(n)/even:偶数odd:奇数/
    /*n--->n是自然数,从0开始查数css从1开始查数*/

CSS3 之选择器_第5张图片

  • E:nth-last-child(n)

在这里插入图片描述

  • E:first-of-type

在这里插入图片描述

  • E:last-of-type

在这里插入图片描述

  • E:only-of-type
    在这里插入图片描述

  • E:nth-of-type(n)
    在这里插入图片描述

  • E:nth-of-last-type(n)

在这里插入图片描述

  • E:empty

在这里插入图片描述

  • E:checked
    CSS3 之选择器_第6张图片
E:enabled		Input:enabled{}  //示能用的样式
E:disabled		Input:disabled{}		//表示不能用的样式
E:read-only    //表示只能选中,不改
E:read-write        //可读可写

calc

条件

1. Position:absolute;

2.  减号两边要有空格

水平居中:left:calc(50%-50px)
垂直居中:top:calc(50%-50px)

div{
width:100px;
height:100px;
border:1pxsolidgray;
position:absolute;
left:calc(50%-50px);
top:calc(50%-50px); 
border-radius:10px20px30px40px;                                                2
}

你可能感兴趣的:(CSS3,css3,css,前端)