html – 如何在CSS中排除元素(通过ID)

栏目: CSS · 发布时间: 7年前

内容简介:我有一个CSS规则,如* {-webkit-transition:all 0.7s ease},这适用于页面上的所有元素,但我想从ID规则中排除一个带有经典ID的元素,如何做到这一点?翻译自:https://stackoverflow.com/questions/12120363/how-to-exclude-an-element-via-id-in-css

我有一个CSS规则,如* {-webkit-transition:all 0.7s ease},这适用于页面上的所有元素,但我想从ID规则中排除一个带有经典ID的元素,如何做到这一点?

用于排除元素的CSS 3伪类是:not.要排除与#classic匹配的所有元素,但保留其余元素,请使用
* :not(#classic) { 
  /* your definitions here */ 
}

请参阅 W3C spec on selectors .请注意,这些CSS3选择器不适用于所有浏览器,特别是旧版本的Internet Explorer会很乐意忽略它们.

翻译自:https://stackoverflow.com/questions/12120363/how-to-exclude-an-element-via-id-in-css


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Web Security, Privacy and Commerce, 2nd Edition

Web Security, Privacy and Commerce, 2nd Edition

Simson Garfinkel / O'Reilly Media / 2002-01-15 / USD 44.95

Since the first edition of this classic reference was published, World Wide Web use has exploded and e-commerce has become a daily part of business and personal life. As Web use has grown, so have ......一起来看看 《Web Security, Privacy and Commerce, 2nd Edition》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具