CSS 笔记六(Image/Attribute Selectors)
Image Opacity / Transparency
- The CSS
opacity
property is a part of the CSS3 recommendation.
Example
img {
opacity: 0.4;
filter: alpha(opacity=40); /* For IE8 and earlier */
} img:hover {
opacity: 1.0;
filter: alpha(opacity=100); /* For IE8 and earlier */
}
Image Sprites
- An image sprite is a collection of images put into a single image.
Example
<!DOCTYPE html>
<html>
<head>
<style>
#navlist {
position: relative;
} #navlist li {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
top: 0;
} #navlist li, #navlist a {
height: 44px;
display: block;
} #home {
left: 0px;
width: 46px;
background: url('img_navsprites_hover.gif') 0 0;
} #prev {
left: 63px;
width: 43px;
background: url('img_navsprites_hover.gif') -47px 0;
} #next {
left: 129px;
width: 43px;
background: url('img_navsprites_hover.gif') -91px 0;
} #home a:hover {
background: url('img_navsprites_hover.gif') 0 -45px;
} #prev a:hover {
background: url('img_navsprites_hover.gif') -47px -45px;
} #next a:hover {
background: url('img_navsprites_hover.gif') -91px -45px;
}
</style>
</head>
<body> <ul id="navlist">
<li id="home"><a href="default.asp"></a></li>
<li id="prev"><a href="css_intro.asp"></a></li>
<li id="next"><a href="css_syntax.asp"></a></li>
</ul> </body>
</html>
CSS Attribute Selectors
- Style HTML elements that have specific attributes or attribute values.
1> CSS [attribute] Selector
- Used to select elements with a specified attribute.
2> CSS [attribute="value"] Selector
- Used to select elements with a specified attribute and value.
Example
a[target] {
background-color: yellow;
}
a[target="_blank"] {
background-color: blue;
}
3> CSS [attribute~="value"] Selector
- Used to select elements with an attribute value containing a specified word.
4> CSS [attribute*="value"] Selector
- Used to select elements whose attribute value contains a specified value.
[title~=flower] {
border: 5px solid yellow;
}
title="klematis flower" > yes
title="flower" > yes
title="tree_flower" > no [class*="te"] {
background: yellow;
}
class="first_test" > yes
class="mytest" > yes
5> CSS [attribute|="value"] Selector
- Used to select elements with the specified attribute starting with the specified value.
6> CSS [attribute^="value"] Selector
- Used to select elements whose attribute value begins with a specified value.
[class|=top] {
background: yellow;
}
class="top-header" > yes
class="top-text" > yes
class="topcontent" > no [class^="top"] {
background: yellow;
</style>
class="top-header" > yes
class="top-text" > yes
class="topcontent" > yes
7> CSS [attribute$="value"] Selector
- Used to select elements whose attribute value ends with a specified value.
[class$="test"] {
background: yellow;
}
class="first_test" > yes
class="my-test" > yes
CSS 笔记六(Image/Attribute Selectors)的更多相关文章
- (3)选择元素——(6)属性选择器(Attribute selectors)
Attribute selectors are a particularly helpful subset of CSS selectors. They allow us to specify an ...
- 《MFC游戏开发》笔记六 图像双缓冲技术:实现一个流畅的动画
本系列文章由七十一雾央编写,转载请注明出处. http://blog.csdn.net/u011371356/article/details/9334121 作者:七十一雾央 新浪微博:http:/ ...
- HTML+CSS笔记 CSS笔记集合
HTML+CSS笔记 表格,超链接,图片,表单 涉及内容:表格,超链接,图片,表单 HTML+CSS笔记 CSS入门 涉及内容:简介,优势,语法说明,代码注释,CSS样式位置,不同样式优先级,选择器, ...
- java之jvm学习笔记六-十二(实践写自己的安全管理器)(jar包的代码认证和签名) (实践对jar包的代码签名) (策略文件)(策略和保护域) (访问控制器) (访问控制器的栈校验机制) (jvm基本结构)
java之jvm学习笔记六(实践写自己的安全管理器) 安全管理器SecurityManager里设计的内容实在是非常的庞大,它的核心方法就是checkPerssiom这个方法里又调用 AccessCo ...
- Learning ROS for Robotics Programming Second Edition学习笔记(六) indigo xtion pro live
中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 Learning ROS for Robotics Pr ...
- Python学习笔记六
Python课堂笔记六 常用模块已经可以在单位实际项目中使用,可以实现运维自动化.无需手工备份文件,数据库,拷贝,压缩. 常用模块 time模块 time.time time.localtime ti ...
- Typescript 学习笔记六:接口
中文网:https://www.tslang.cn/ 官网:http://www.typescriptlang.org/ 目录: Typescript 学习笔记一:介绍.安装.编译 Typescrip ...
- Django开发笔记六
Django开发笔记一 Django开发笔记二 Django开发笔记三 Django开发笔记四 Django开发笔记五 Django开发笔记六 1.登录功能完善 登录成功应该是重定向到首页,而不是转发 ...
- python3.4学习笔记(六) 常用快捷键使用技巧,持续更新
python3.4学习笔记(六) 常用快捷键使用技巧,持续更新 安装IDLE后鼠标右键点击*.py 文件,可以看到Edit with IDLE 选择这个可以直接打开编辑器.IDLE默认不能显示行号,使 ...
随机推荐
- unity3d插件Daikon Forge GUI 中文教程3-基础控件Button和Sprite的使用
2.2添加一个按钮Button 来看看特有的属性:Button Properties Data 显示的文本 Behavior 中的几个: Aoto Size 选中时就是按钮的背景会根据Data中的文本 ...
- centos6 搭建ELK
mark一下时间:2016年2月19日10:17:09 记录使用 Logstash: Logstash服务的组件,用于处理传入的日志. Elasticsearch: 存储所有日志 Kibana 4: ...
- 在strut.xml 中使用ognl
在struts.xml 中使用ognl有两种方面的需求: 1. 在action执行时从struts.xml中读取param标签中的值,然后调用标签name属性相应的set方法对action中的变量赋值 ...
- BizTalk动手实验(六)Orchestration开发
1 课程简介 通过本课程熟悉Orchestration的相关开发与测试技术 2 准备工作 熟悉XML.XML Schema.XSLT等相关XML开发技术 熟悉.NET相关开发技术 新建BizTalk空 ...
- jQuery判断元素是否存在方法总结
在jquery中判断元素是否存在我们可使用$("#div").length > 0)来判断了,意思就是判断元素长度了,如果没有肯定是不存在的哦,下面我来介绍介绍. 使用传统j ...
- html5 调用摄像头
---移动设备--- <input type="file" capture="camera" accept="image/*" id= ...
- Windows7如何安装Sqlite3
Sqlite官网地址:http://www.sqlite.org/ Sqlite3文件下载: 1.下载 sqlite-dll-win32-x86-3140100 2.下载 sqlite-tools-w ...
- html中select只读显示
因为Select下拉框只支持disabled属性,不支持readOnly属性,而在提交时,disabled的控件,又是不提交值的.现提供以下几种解决方案: 1.在html中使用以下代码,在select ...
- python - ConfigParser
ConfigParse 作用是解析配置文件. 配置文件格式如下 [test1]num1: 10[test2]num1: 35 配置文件两个概念section和option, 在这个例子中第一个sect ...
- $(document).ready(function(){});
$(document).ready 里的代码是在页面内容都加载完才执行的,你直接写到script标签里,当页面加载完这个script标签就会执行里边的代码了,如果你标签里执行的代码调用了当前还没加载过 ...