zoukankan      html  css  js  c++  java
  • CSS3中first-child、last-child、nth-child、nth-last-child

    1.单独指定第一个子元素、最后一个子元素的样式

    <style type="text/css">

    li:first-child{

      background:yellow;

    }

    li:last-child{

       background:blue;

    }

    </style>

    2.对指定序号的子元素使用样式

    <style type="text/css">

    li:nty-child(2){

      background:yellow;

    }//对第二个子元素设定背景色

    li:nth-last-child(2){

      background:blue;

    }//对倒数第二个子元素设定背景色

    </style>

    3.对所有第偶数个子元素或者第奇数个子元素使用样式

    <style type="text/css">

    li:nth-child(odd){

      background:yellow;

    }

    li:nth-child(even){

     background:blue

    }

    </style>

  • 相关阅读:
    python redis
    Celery
    RabbitMQ
    python的文件锁操作
    cloud-init alibaba
    cloud-init tencent
    关于 python 的类
    jnija2模板渲染
    python multiprocessing
    学习html5的WebSocket连接
  • 原文地址:https://www.cnblogs.com/wyaocn/p/5836555.html
Copyright © 2011-2022 走看看