CSS属性选择符
属性选择符:
E[att] 选择具有att属性的E元素。
<style type="text/css">
a[class]{ background-color: red;}
</style>
<body>
<a href="" class="a">链接a</a>
<a href="" id="b">链接b</a>
</body>
E[att="val"] 选择具有att属性且属性值等于valu的E元素。
<style type="text/css">
a[class="1"]{ background-color: red;}
</style>
<body>
<a href="" class="1">链接a</a>
<a href="" class="2">链接b</a>
</body>
E[att~="val"] 选择具有att属性且属性值为一用空格分隔的字词列表,其中一个等于val的E元素。
<style>
a[class~="id"]{color: red;}
</style>
<body>
<ul>
<li><a href="" class="id 1">链接a</a></li>
<li><a href="" class="1">链接b</a></li>
<li><a href="" class="1">链接b</a></li>
</body>
E[att^="val"] 选择具有att属性且属性值为以val开头的字符串的E元素。
<style>
a[title~=""]
{color:red;}
</style>
<body>
<a href="http://www.163.com/" title="www 163 com">红色</a>
<a href="http://www.baidu.com/" title="www baidu com">红色</a>
</body>
E[att$="val"] 选择具有att属性且属性值为以val结尾的字符串的E元素。
<style>
li[class$="a"] {color: #f00;}
</style>
</head>
<body>
<ul>
<li class="abc">列表项目</li>
<li class="acb">列表项目</li>
</ul>
</body>
E[att*="val"] 选择具有att属性且属性值为包含val的字符串的E元素。
<style type="text/css">
a[href*=".html"]{color:red;}
a[href*=".php"]{color:green;}
a[href*=".jsp"]{color:blue;}
</style>
<body>
<a href="http://www.dreamdu.com/css.html?id=1&name=www">梦之都红色字体</a>
<a href="http://www.dreamdu.com/css.php?id=2&name=dreamdu">梦之都绿色字体</a>
<a href="http://www.dreamdu.com/css.jsp?id=3&name=com">梦之都蓝色字体</a>
</body>
E[att|="val"] 选择具有att属性且属性值为以val开头并用连接符"-"分隔的字符串的E元素。
<style type="text/css">
a[title~="dreamdu"]{color:red;}
</style>
<body>
<a href="http://www.dreamdu.com/" title="www dreamdu com">红色</a>
</body>
font-family,font-size,font-weight,font-style
<style type="text/css">
p { font-family: "宋体";}
h1 { font-size:14px ;}
h2 { font-weight: normal ;}
h3 {font-style: italic;}
</style>
</head>
<body>
<p>这是一个标签</p>
<h1>这是一个标签</h1>
<h2>这是一个标签</h2>
<h3>这是一个标签</h3>
</body>
font(字体样式缩写)
<style type="text/css">
/*p{font-style:italic;
font-weight:bold;
font-size:14px;
line-height:22px;
font-family:宋体;}*/
p {font:italic bold 14px/22px 宋体}
</style>
</head>
<body>
<p>这是一个标签</p>
</body>
</html>
text-decoration(文本装饰线条),text-shadow(文字阴影)
<style type="text/css">
p { text-decoration: underline;
text-shadow: 2px 2px #ff0000; }
</style>
</head>
<body>
<p>这是一个标签</p>
</body>
width,height
<style type="text/css">
p { width:300px;}
div { height:100px; padding: 1px; border:1px solid;}
</style>
</head>
<body>
<p>这是一个标签这是一个标签这是一个标签这是一个标签</p>
<div>这是一个标签</div>
</body>

CSS属性选择符的更多相关文章
- 强大的CSS 属性选择符 配合 stylish 屏蔽新浪微博信息流广告
新建一条微博域名下的规则: @-moz-document domain("weibo.com") { #v6_pl_rightmod_rank,#v6_pl_rightmod_ad ...
- #8.10.16总结# 属性选择符 伪对象选择符 CSS的常用样式
属性选择符 E[att] E[att="val"] E[att~="val"] E[att^="val"] E[att$="val ...
- css关系选择符
<!Doctype html> <html> <head> <meta http-equiv="Content-Type" content ...
- CSS3初学篇章_3(属性选择符/字体样式/元素样式)
属性选择符 选择符 说明 E[att] 选择具有att属性的E元素. E[att="val"] 选择具有att属性且属性值等于val的E元素. E[att~=&quo ...
- CSS 组合选择符
CSS 组合选择符 组合选择符说明了两个选择器直接的关系. CSS组合选择符包括各种简单选择符的组合方式. 在 CSS3 中包含了四种组合方式: 后代选取器(以空格分隔) 子元素选择器(以大于号分隔) ...
- CSS:CSS 组合选择符
ylbtech-CSS:CSS 组合选择符 1.返回顶部 1. CSS 组合选择符 CSS 组合选择符 组合选择符说明了两个选择器直接的关系. CSS组合选择符包括各种简单选择符的组合方式. 在 CS ...
- CSS高级选择符
2016-11-07 <css入门经典>第八章 1.属性选择器 选择器 描述 [attribute] 用于选取带有指定属性的元素. [attribute=value] 用于选取带有指定属性 ...
- CSS 的选择符
CSS是什么? 如果说元素是标记代码的构建块料,那么CSS就是约束这些构建块料样式的规则. CSS规则的组成 CSS的规则由 选择符 和属性,值组成. Css选择符:选择符是规则中用于确定样式所涵盖的 ...
- CSS之选择符、链接、盒子模型、显示隐藏元素
<html> <head> <meta charset="utf-8"> <title>选择符.链接.盒子模型.显示隐藏元素< ...
随机推荐
- 【状压DP】bzoj1087 互不侵犯king
一.题目 Description 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案.国王能攻击到它上.下.左.右,以及左上.左下.右上.右下八个方向上附近的各一个格子,共8个格子. I ...
- 【Spring】简单的Spring AOP注解示例
引入相关包: <properties> <spring.version>3.0.5.RELEASE</spring.version> <aspectj.ver ...
- 使用Python调用Flickr API抓取图片数据
Flickr是雅虎旗下的图片分享网站,上面有全世界网友分享的大量精彩图片,被认为是专业的图片网站.其API也很友好,可以实现多种功能.这里我使用了Python调用其API获得了大量的照片数据.需要注意 ...
- BOM里的window命令; cookie的用法
js得到屏幕宽度高度,页面宽度高度 window.screen.availWidth 返回当前屏幕宽度(空白空间) window.screen.availHeight 返回当前屏幕高度(空白空间) w ...
- python之socket
一.初识socket socket 是网络连接端点,每个socket都被绑定到一个特定的IP地址和端口.IP地址是一个由4个数组成的序列,这4个数均是范围 0~255中的值(例如, ...
- sql 连接查询的区别 inner,left,right,full
--table1 表 ID NAME QQ PHONE1 秦云 10102800 135000002 在路上 10378 136000003 LEO 10000 139000004 秦云 024145 ...
- 远程执行shellcode
#include "Windows.h" #include <WinSock2.h> #include <stdio.h> #pragma comment( ...
- 使用spring aspect控制自定义注解
自定义注解:这里是一个处理异常的注解,当调用方法发生异常时,返回异常信息 /** * ErrorCode: * * @author yangzhenlong * @since 2016/7/21 */ ...
- js float 数据相加,有的正确,有的不对
转:http://bbs.csdn.net/topics/360259080 //浮点数加法运算function FloatAdd(arg1,arg2){ var r1,r2,m; try ...
- PHP Mysqli 数据库连接
---恢复内容开始--- $connection=new mysqli($db_host,$db_user,$db_password,$db_name);if(!mysqli_connect_errn ...