CSS新增表单属性及结构伪类选择器(nth-child)

input表单属性

二、CSS新增属性选择器

三、CSS新增结构伪类选择器

⚠️注意:nth-child会将 父亲盒子 里的所有的 子盒子 都首先排列序号,无论是p、div等等;之后从头遍历找寻div。

这时候可以使用nth-of-type  ——>排列指定元素的序号

section div:nth-og-type(1) {
    
    background-color:blue;

}

举例:

四、CSS新增伪元素选择器的基本使用

div::before  权重为2

before和after的元素盒子在浏览器的元素检查中不显示

举例 :

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box {
        height: 300px;
        width: 300px;
        background-color: #900b0b;
        color: aliceblue;
        margin: 0 auto;
    }

    .box::before {
        /* 这个content必须存在 */
        content: '我';

    }

    .box::after {
        content: '约翰•皮耶夏特•安努•不理不理•肥嘟嘟左卫门';
    }
</style>

<body>
    <div class="box">
        是
    </div>
</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逃逸线LOF

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值