CSS选择器
来源:互联网 发布:为什么python安装失败 编辑:程序博客网 时间:2024/06/06 23:20
对于同样的CSS属性,选择器优先级是,id选择器>class选择器>标签名选择器。class+标签名选择器>class选择器。对于不同的CSS属性,继承。上面优先级反走。
</pre><pre name="code" class="html"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>CSS的基本选择器</title></head><style type="text/css">h1{color:blue; font-size:25px; text-decoration:underline;}/*标签选择器 */em{ color:red;}p span{ color:green;}p{font-weight:normal; font-size:55px;}.red{ color:red; font-size:55px;}/*类选择器使用"."进行标识,后紧跟类名 */.two{ font-weight:lighter; font-size:13px;}.father div{ background-color:red;.son{background-color:blue;}#one{ font-weight:bold; font-size:36px;} /*ID选择器使用“#”前缀标识符进行标识 */}</style><body><h1>标签名选择器</h1><p class="red">class选择器</p><p id="one">id选择器</p><p><span>嵌套选择器</span></p><h1><em>嵌套选择有继承特性</em></h1><p id="one" style=" font-weight:lighter; font-size:13px">行内样式>ID选择器</p><p id="one" class="two">ID选择器>class选择器</p><p class="two">class选择器>标签名选择器</p><div class="father">背景色为red<div class="son">class+标签名选择器>class选择器</div></div></body></html>
效果图:
0 0
- CSS选择器,jQuery选择器
- jQuery选择器 CSS选择器
- css选择器-基本选择器
- css选择器-属性选择器
- CSS选择器选择器
- CSS选择器-属性选择器
- css选择器
- css选择器
- css选择器
- Css选择器!
- CSS选择器
- css选择器
- CSS选择器
- CSS选择器
- CSS选择器
- CSS选择器
- css选择器
- css选择器
- NSDate与时间戳的那点事
- Linux性能测试 vmstat命令
- 个比较乐观vjlkvfhj
- HDU 1254 推箱子
- 财富阶层发过几次规范化
- CSS选择器
- node js 异步执行流程控制模块Async介绍
- Linux 性能监控
- 234242
- cocos2d-x 取真正随机数 【亲测有效】
- STL格式简介
- bzoj1045: [HAOI2008] 糖果传递 贪心
- Java数据类型中String、Integer、int相互间的转换
- 1002