web开发

 /* 必须是input,但是要具有value这个属性 */

        input[value]{

            color: pink;

        }

        input[type=tel] {

            color: skyblue;

        }

        /* 选择div中以icon开头的元素 */

        div[class^=icon]{

            color: green;

        }

          /* 选择div中以data结尾的元素 */

        section[class$=data]{

            color: pink;

        }

        /* 类选择,属性选择器,伪类选择器,权重都是10 */

        /* 选择ul中的第一个孩子 */

        ul li:first-child {

            background-color: pink;

        }

         /* 选择ul中的最后一个孩子 */

        ul li:last-child {

            background-color: pink;

        }

        /* 选择其他的孩子nth-child(数字代表第几个) */

        ul li:nth-child(2){

            background-color: skyblue;

        }

        ul li:nth-child(4){

            background-color: green;

        }

        /* 把所有偶数的孩子选择出来,odd,2n,都代表偶数 */

        ul li:nth-child(even) {

            background-color: purple;

        }

         /* 把所有偶数的孩子选择出来,even,2n+1,都代表奇数 */

        ul li:nth-child(odd){

            background-color: aqua;

        }

        /* 选择了所有孩子,nth-child(n),括号里只能是n,不能是其他字母 */

        ol li:nth-child(n){

            background-color: blue;

        }

        /* 从第三个开始,后面的颜色为淡黄色 */

        ol li:nth-child(n+3){

            background-color: bisque;

        }

        /* 从第四个开始,前面的颜色为橘色 */

        ol li:nth-child(-n+4){

            background-color: orange;

        }

  </style>

</head>

<body>

    <!-- box1里是关于新增属性选择器 -->

    <div class=".box1">

    <!-- 1.利用属性选择器可以不借助类或者id选择器 -->

    <input type="text" value="请输入用户名">

    <input type="text">

    <!-- 2,属性选择器可以选择属性=值的某些元素((重点)-->

    <input type="tel" name="" id="">

    <input type="password" name=""id>

    <!-- 标签选择器为权重为1 -->

    <!-- 权重相同采用就近原则 -->

    <!-- 3,属性选择器可以选择属性值开头的某些元素 -->

    <div class="icon1">小图标1</div>

    <div class="icon2">小图标2</div>

    <div class="icon3">小图标3</div>

    <div class="icon4">小图标4</div>

    <div class="icon5">小图标5</div>

    <div>我是打酱油的</div>

    <section class="icon1data">1111</section>

    <section class="icon2data">2222</section>

    <section class="icon2data">3333</section>

    <section class="icon2da">444</section>

</div>

<!-- box里是关于新增伪类选择器 -->

<div class="box2">

    <ul>

        <li>我是菜单1</li>

        <li>我是菜单2</li>

        <li>我是菜单3</li>

        <li>我是菜单4</li>

        <li>我是菜单5</li>

        <li>我是菜单6</li>

        <li>我是菜单7</li>

        <li>我是菜单8</li>

    </ul>

    <ol>

        <li>菜单1</li>

        <li>菜单2</li>

        <li>菜单3</li>

        <li>菜单4</li>

        <li>菜单5</li>

    </ol>

</div>

</body>

</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值