属性选择符:

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属性选择符的更多相关文章

  1. 强大的CSS 属性选择符 配合 stylish 屏蔽新浪微博信息流广告

    新建一条微博域名下的规则: @-moz-document domain("weibo.com") { #v6_pl_rightmod_rank,#v6_pl_rightmod_ad ...

  2. #8.10.16总结# 属性选择符 伪对象选择符 CSS的常用样式

    属性选择符 E[att] E[att="val"] E[att~="val"] E[att^="val"] E[att$="val ...

  3. css关系选择符

    <!Doctype html> <html> <head> <meta http-equiv="Content-Type" content ...

  4. CSS3初学篇章_3(属性选择符/字体样式/元素样式)

    属性选择符  选择符  说明  E[att]  选择具有att属性的E元素.  E[att="val"]  选择具有att属性且属性值等于val的E元素.  E[att~=&quo ...

  5. CSS 组合选择符

    CSS 组合选择符 组合选择符说明了两个选择器直接的关系. CSS组合选择符包括各种简单选择符的组合方式. 在 CSS3 中包含了四种组合方式: 后代选取器(以空格分隔) 子元素选择器(以大于号分隔) ...

  6. CSS:CSS 组合选择符

    ylbtech-CSS:CSS 组合选择符 1.返回顶部 1. CSS 组合选择符 CSS 组合选择符 组合选择符说明了两个选择器直接的关系. CSS组合选择符包括各种简单选择符的组合方式. 在 CS ...

  7. CSS高级选择符

    2016-11-07 <css入门经典>第八章 1.属性选择器 选择器 描述 [attribute] 用于选取带有指定属性的元素. [attribute=value] 用于选取带有指定属性 ...

  8. CSS 的选择符

    CSS是什么? 如果说元素是标记代码的构建块料,那么CSS就是约束这些构建块料样式的规则. CSS规则的组成 CSS的规则由 选择符 和属性,值组成. Css选择符:选择符是规则中用于确定样式所涵盖的 ...

  9. CSS之选择符、链接、盒子模型、显示隐藏元素

    <html> <head> <meta charset="utf-8"> <title>选择符.链接.盒子模型.显示隐藏元素< ...

随机推荐

  1. Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) B

    Description Santa Claus decided to disassemble his keyboard to clean it. After he returned all the k ...

  2. MVC的多表单

    中心思想就是在一个表单内不规定"action",在js里面用@Url.Axtion("视图层","控制器")方法来设置表单的传值. 控制器 ...

  3. 【前端】JSON.stringfy 和 JSON.parse(待续)

    JSON.stringfy 和 JSON.parse(待续) 支持全局对象JSON的浏览器有:IE8+, FireFox3.5+, Safari4+, Chrome, Opera10.5+ JSON. ...

  4. Button的enabled和clickabled的区别

    Button的enabled和clickabled的区别 setEnable设置用户是否可以点击此按钮,setClickable设置程序在某个条件下自动点击此按钮  

  5. [转](六)unity4.6Ugui中文教程文档-------概要-UGUI Animation Integration

    5.Animation Integration(动画集成) 动画允许控件的所有状态之间相互转换,充分使用unity的动画系统.这是最强大的的转换模式的在处理很多属性的同时可以进行动画. 要使用动画转换 ...

  6. pandas处理数据1

    读文件 pd.read_csv('path/to/file.txt',header=0,names='ab',index_col=0) names Columns这个可以不写,制定索引列是第一列,这样 ...

  7. Strus2第一次课:dom4j操作xml

    先从底层的xml操作技术记录: 当我们新建一个项目,什么架包都没加入的时候,java提供了 org.w3c.dom给我们操作xml里面的元素 import org.w3c.dom.Document; ...

  8. ThinkPHP3.2中if判断条件是两个变量

    <select name="typeId"> <foreach name="typeInfo" item="v"> ...

  9. 慕课网__CSS__vertical align

  10. 【java基础】 合并两个类型相同的list

    将两个类型相同的list合并,可以用 addAll(Collection<? extends E> c) import java.util.ArrayList; import java.u ...