• css:nth-of-type()选择器用法


    今天做一个页面,无意中看到这个nth-of-type感觉挺方便的,之前单双行有的有横线,有的无横线一般在html中单独再写border-right:none等之类的。现在发现这个好东西赶紧记录下来。

    :nth-of-type(n) 选择器匹配属于父元素的特定类型的第 N 个子元素的每个元素.n 可以是数字、关键词或公式。

    .uninstall_form .uninstall_list_checkbox:nth-of-type(odd){border-right:1px solid #e6e6e6}
    <form onsubmit="return check()" action="" method="post" name="post_unintall" id="post_unintall"> <div class="uninstall_list"> <input type="checkbox" id="uninstall_list1" name="my_check[]" value="1"> <label class="uninstall_list_checkbox">我想下某个软件结果下载了安智市场</label> </div> <div class="uninstall_list"> <input type="checkbox" id="uninstall_list1" name="my_check[]" value="2"> <label class="uninstall_list_checkbox">手机出问题,卸载了重装试试</label> </div> <div class="uninstall_list"> <input type="checkbox" id="uninstall_list2" name="my_check[]" value="3"> <label class="uninstall_list_checkbox">软件不全,好多软件找不到</label> </div>        
            .....
    </form>

    odd奇数行右面有一条线  even偶数行没有,还可以用2n+1表示奇数,2n表示偶数,3n+1表示每个三个显示。

    类似的也有

    :nth-child(n) 选择器匹配属于其父元素的第 N 个子元素,不论元素的类型。n 可以是数字、关键词或公式。

    有一个css样式我感觉也很有用  记录下来

    background-clip: border-box|padding-box|content-box;

    background-clip 属性规定背景的绘制区域。

    border-box是背景被裁剪到边框盒。

    效果这样的

    padding-box背景被裁剪到内边距框。

    效果这样的:

    content-box是背景被裁剪到内容框。

    效果是这样:

  • 相关阅读:
    【C++】C++代码动态检查
    【加解密】使用CFSSL生成证书并使用gRPC验证证书
    分库分表下跨库join解决方案
    解决1235
    为什么v-for中的key值不推荐使用index
    弹性布局公共样式总结
    关于python的模块
    [转]Ubuntu18.04安装uwsgi错误:error: lto-wrapper failed collect2: error: ld returned 1 exit status
    python 坐标遍历 生成笛卡尔积矩阵
    Mongo BsonUndefined 转换问题(自定义Mongo类型转换器)
  • 原文地址:https://www.cnblogs.com/angellating/p/4778605.html
Copyright © 2020-2023  润新知