博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CSS 笔记六(Image/Attribute Selectors)
阅读量:4452 次
发布时间:2019-06-07

本文共 2136 字,大约阅读时间需要 7 分钟。

 Image Opacity / Transparency

  • The CSS opacity property is a part of the CSS3 recommendation.

Example

1 img {2     opacity: 0.4;3     filter: alpha(opacity=40); /* For IE8 and earlier */4 }5 6 img:hover {7     opacity: 1.0;8     filter: alpha(opacity=100); /* For IE8 and earlier */9 }

Image Sprites

  • An image sprite is a collection of images put into a single image.

Example

navigation images

1  2  3  4 52 53 54 55 
60 61 62

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

1 a[target] {2     background-color: yellow;3 } 4 a[target="_blank"] {5     background-color: blue;6 }

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.
1 [title~=flower] { 2     border: 5px solid yellow; 3 } 4 title="klematis flower"   > yes 5 title="flower"            > yes 6 title="tree_flower"       > no 7  8 [class*="te"] { 9     background: yellow;10 }11 class="first_test"        > yes12 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.
1 [class|=top] { 2     background: yellow; 3 } 4 class="top-header"    > yes 5 class="top-text"      > yes 6 class="topcontent"    > no 7  8 [class^="top"] { 9     background: yellow;10 11 class="top-header"    > yes12 class="top-text"      > yes13 class="topcontent"    > yes

7> CSS [attribute$="value"] Selector

  • Used to select elements whose attribute value ends with a specified value.
1 [class$="test"] {2     background: yellow;3 }4 class="first_test"      > yes    5 class="my-test"         > yes

 

转载于:https://www.cnblogs.com/hzj680539/p/5088987.html

你可能感兴趣的文章
js 不固定传参
查看>>
远程调试UWP遇到新错误Could not generate the root folder for app package ......
查看>>
git--windwos下的安装与使用(一)
查看>>
[倍增][最短路-Floyd][dp]
查看>>
SpringAOP用到了什么代理,以及动态代理与静态代理的区别
查看>>
利用STM32CubeMX来生成USB_HID_Mouse工程【添加ADC】(1)
查看>>
【leetcode】Populating Next Right Pointers in Each Node
查看>>
获取请求参数乱码的问题
查看>>
代码实现:判断E盘目录下是否有后缀名为.jpg的文件,如果有,就输出该文件名称...
查看>>
Android客户端测试点
查看>>
Jquery:怎样让子窗体的div显示在父窗体之上
查看>>
01概率
查看>>
.NET LINQ 元素操作
查看>>
Shell脚本
查看>>
MatLab Load cv::Mat 导入数据
查看>>
html+css相关笔记(一)
查看>>
基于块流协议保证音频优先发送
查看>>
关于互联网的一些数据
查看>>
nginx+lua_nginx+GraphicsMagick生成实时缩略图
查看>>
数据预处理:独热编码(One-Hot Encoding)
查看>>