CSS选择器
来源:互联网 发布:mac控制中心在哪里 编辑:程序博客网 时间:2024/06/07 03:03
- 概要:
在html中,选择器就是用来在页面中定位元素使用。浏览器对于不同类型的选择器使用不同的方法查找元素;核心的选择器如下表所示(他们也是应用最为广泛的选择器):
- 多种选择器总结:
一般情况下,使用基于id和class属性选取元素(简单选择器)。除了这 种情况之外,还有如下多种选择器方式可供使用:
① 属性选择器
样例代码如下:...[lang]{ background-color: grey; color: #ffffff;}[lang$="s"]{ font-size: 14px;}......<body><h1 lang="en">h1类标题</h1><h2 lang="en">h2类标题</h2><h2 lang="es">h2类标题</h2>...
② 关系选择器
样例代码如下:...h1 ~ [lang]{ background-color: grey; color: #ffffff;}......<h2 lang="">h2类标题</h2><h1 > h1类标题 <span lang="">span <span>span的后代元素</span> </span></h1><h2 lang="">h2类标题</h2><h2 lang="es">h2类标题</h2>...
③ 伪元素和伪类选择器
样例代码如下:...p:first-letter{ font-size: x-large; color: red;}:nth-of-type(2){ background-color: red; color: #000000;}...
④ 联合选择器和反选择器
利用选择器组合实现联合选择和反选择。
样例代码如下:...h1, h2{ background-color: red; color: #000000;}:not(html):not(body):not(:first-child){ border: medium double #000000;}...
1 0
- CSS选择器,jQuery选择器
- jQuery选择器 CSS选择器
- css选择器-基本选择器
- css选择器-属性选择器
- CSS选择器选择器
- CSS选择器-属性选择器
- css选择器
- css选择器
- css选择器
- Css选择器!
- CSS选择器
- css选择器
- CSS选择器
- CSS选择器
- CSS选择器
- CSS选择器
- css选择器
- css选择器
- 适配 6 6 +
- UIScrollView 滚动视图—IOS开发
- 蓝桥杯PREV_08买不到的数目(动态规划)
- ?????????????????????
- Memcache的最佳实践方案(基本知识)
- CSS选择器
- shell编程——日志输出的同时显屏
- apache commons pool2: 整体结构
- Redis源代码分析
- Java解析XML汇总(DOM/SAX/JDOM/DOM4j/XPath)
- Visual Studio程序打包软件——InstallShield(1)
- C语言memmove函数
- 第九周 项目五
- Quartz Core 图层编程