CSS3 之选择器

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

在这里插入图片描述

2、属性选择器

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

在这里插入图片描述

3、伪元素选择器

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

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

在这里插入图片描述

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

在这里插入图片描述

  • E:target

在这里插入图片描述

//eg:
<ahref="#box1"></a>
<ahref="#box2"></a>
<divclass="box1"></div>
<divclass="box2"></div>

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

  • E:first-childE:last-child

在这里插入图片描述

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

在这里插入图片描述

  • 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
    在这里插入图片描述
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
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值