好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

css中:not用法是什么

在css中,“:not”是选择器的一种,如果希望某个样式不作用到选择器上,可以使用:not(选择器),语法格式为“ 元素:not(元素id){属性:属性值;}”;该选择器匹配非指定元素/选择器的每个元素。

本教程操作环境:windows7系统、CSS3 && HT ML 5版、Dell G3 电 脑。

如果希望某个样式不作用到选择器上,可以使用:not(选择器)

如:

<input ty PE ="text" value="1" />
<input type="text" value="2" />
<input type="text" class="no- red " value="3"/>
input[type="text"] {
    dis play : block;
    width: 300px;
    h ei ght: 30px;
    m arg in-bottom: 20px;
    padding-left: 10px;
    color: red;
}

这样写效果如下:

如果希望input[type=“text”]的样式不作用到第三个input上,可以这样写:

input[type="text"]:not(.no-red) {
    display: block;
    width: 300px;
    height: 30px;
    mar gin -bottom: 20px;
    padding-left: 10px;
    color: red;
}

则效果如图所示:

推荐学习:css视频教程

以上就是css中:not用法 是什么 的详细内容,更多请关注其它相关 文章 !

总结

以上是 为你收集整理的 css中:not用法是什么 全部内容,希望文章能够帮你解决 css中:not用法是什么 所遇到的问题。

如果觉得 网站内容还不错, 推荐好友。

查看更多关于css中:not用法是什么的详细内容...

  阅读:16次