属性选择符:

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. Java SE 基础:标识(zhì)符

    Java SE 基础:标识(zhì)符 一.标识符定义 标识符,就是给类.接口.方法.变量等起名字时的字符序列 二.组成规则与注意事项 1.组成规则 英文大小写字母 数组 $ 和 _ 2.注意事项 不 ...

  2. CEF源码编译和生产库的使用

    CEF版本是Branch 2171 开发环境是VS2012 查看一下libcef_dll_wrapper工程属性,确定Code Generation 选择MTD(Debug) 或者MT(Release ...

  3. 两行代码搞定 JavaScript 的日期验证

    我们通常在 JavaScript 中验证日期,基本的思路大概是,先判断年月日是否有效,再判断当月是否有当日,比如一些月份没有 31 日,平年二月没有 29.30 日,闰年二月没有 30 日等等. 偶然 ...

  4. jQuery 学习笔记

    jQuery 学习笔记   一.jQuery概述    宗旨: Write Less, Do More.    基础知识:        1.符号$代替document.getElementById( ...

  5. HackPwn2015:IoT智能硬件安全威胁分析

    HackPwn2015:IoT智能硬件安全威胁分析 360安全卫士 · 2015/08/26 14:43 IoT(物联网)是一种既危险又有趣的混合技术,所谓的混合技术包括移动应用程序.蓝牙.Wi-Fi ...

  6. webform分页

    前端界面: 当前第[<asp:Label ID="Label_nowpage" runat="server" Text="Label" ...

  7. spa 单页面解决浏览器back front 问题

    1.angular router reloadOnSearch:true(default) | false  默认为true,当url的hash发生改变,页面新渲染,component会重新加载(初始 ...

  8. windows字符串

    CString在win32环境下最大的有效长度应该是INT_MAX-1 一般小于这个长度的文件,处理字符串都没问题. TCHAR字符串数组没有处理子串的相关函数,strchr(_tcschr)只是处理 ...

  9. python学习--字符串

    python的字符串类型为str 定义字符串可以用 ‘abc' , "abc", '''abc''' 查看str的帮助 在python提示符里 help(str) python基于 ...

  10. ToolBar 修改边距

    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android ...