CSS 多类选择器
来源:互联网 发布:微信支付开发案例java 编辑:程序博客网 时间:2024/06/06 02:02
写的代码多了,就会发现,自己越来越无知了,总以为html css很简单,已经掌握的很熟练了,其实我还差的很多。
平时没有用过css的这种写法 .a.b{display:block;} 上网一查才明白。
参考:http://www.w3school.com.cn/css/css_selector_class.asp
1、在 HTML 中,一个 class 值中可能包含一个词列表,各个词之间用空格分隔。例如,如果希望将一个特定的元素同时标记为重要(important)和警告(warning),就可以写作(这两个词的顺序无关紧要,写成 warning important 也可以):
<p class="important warning">This paragraph is a very important warning.</p>
我们假设 class 为 important 的所有元素都是粗体,而 class 为 warning 的所有元素为斜体,class 中同时包含 important 和 warning 的所有元素还有一个银色的背景 。就可以写作:
.important {font-weight:bold;}.warning {font-weight:italic;}.important.warning {background:silver;}
2、通过把两个类选择器链接在一起,仅可以选择同时包含这些类名的元素(类名的顺序不限)。
如果一个多类选择器包含类名列表中没有的一个类名,匹配就会失败。请看下面的规则:
.important.urgent {background:silver;}
不出所料,这个选择器将只匹配 class 属性中包含词 important 和 urgent 的 p 元素。因此,如果一个 p 元素的 class 属性中只有词 important 和 warning,将不能匹配。不过,它能匹配以下元素:
<p class="important urgent warning">This paragraph is a very important and urgent warning.</p>
0 0
- CSS 多类选择器
- CSS多类选择器
- CSS 多类选择器
- CSS 多类选择器
- CSS 多类选择器
- CSS 多类选择器
- CSS 多类选择器
- CSS 多类选择器
- CSS 类选择器详解——CSS 多类选择器
- css标签选择器,类选择器
- css选择器-伪类选择器
- CSS - 选择器(标签选择器、类选择器、ID选择器)
- css派生选择器、id选择器、类选择器、属性选择器
- 五类CSS选择器
- 五类css选择器
- 五类CSS选择器
- 五类CSS选择器
- CSS伪类选择器
- 模型的统计检验
- python入门 第6章 Dict和Set类型
- Cannot read property 'name' of undefined @ injectScripts.min.js:1
- C#委托的介绍(delegate、Action、Func、predicate)
- linux如何关闭防火墙
- CSS 多类选择器
- 实现手机网页调起原生微信朋友圈分享的工具nativeShare.js
- Swift Buttons
- lsof 命令使用
- 转载(Linux常用命令)http://blog.csdn.net/xiaoguaihai/article/details/8705992
- c# access sql where
- QT5使用入门
- 玩转vsftpd服务器的四大高级配置
- 文章标题