Odd CSS syntax. [class^='icon-'], [class*=' icon-']
原文: https://stackoverflow.com/questions/20322740/odd-css-syntax-class-icon-class-icon
I am going through someone else's CSS code at the moment and found something I have not seen before, nor am I able to find anything on W3C schools about these types of selectors. Google also doesn't return anything if I type in "class^="
Would appreciate it if someone could shed some light on this please?
-----------------------------------------------------------------------
This is somewhat comprehensively covered here:
http://reference.sitepoint.com/css/css3attributeselectors
Quick summary:
[class^='icon-'] - classes starting with 'icon-' (eg. class='icon-blah blah')
[class$='-icon'] - classes ending with '-icon' (eg. class='blah blah-icon')
[class*='icon'] - classes containing 'icon' (eg. class='blah xxx-icon-blah')
It's worth noting that this is a full string matching pattern not a partial matching pattern. So for example, the class:
<div class='mystyle-type'/>
Will match to the selector [class^='mystyle'] but the class:
<div class='active mystyle-type'/>
Will not match, because the string 'active mystyle-type' does not start with 'mystyle'.
This can be problematic with javascript that adds classes dynamically like jquery's 'addClass'.
Odd CSS syntax. [class^='icon-'], [class*=' icon-']的更多相关文章
- CSS之fontAwesome代替网页icon小图标
引言 奥森图标(Font Awesome)提供丰富的矢量字体图标—通过CSS可以任意控制所有图标的大小 ,颜色,阴影. 网页小图标到处可见,如果一个网页都是干巴巴的文字和图片,而没有小图标,会显得非常 ...
- 字体图标 icon font
Icon font icon font 指的是用字体文件代替图片文件,来展示图标.特殊字体等元素的方法. 应用场景: iconfont的优缺点 大小能够自由地变化 颜色能够自由地改动 加入阴影效果 * ...
- HTML及CSS学习笔记
推荐博客:付铭 day-01 HTML 1.HTML 基本语法 html标签 单标签 <img /> .<img> 双标签 <html> </html> ...
- CSS 学习手册
目录 CSS 简介 1.CSS 简介 CSS 概述 层叠次序 2.CSS 基础语法 CSS 语法 值的不同写法和单位 记得写引号 多重声明: 空格和大小写 3.CSS 高级语法 选择器的分组 继承及其 ...
- html和css的重难点知识
目录 html总难点总结: 1. 块级标签与内联标签的区别 1.1 块级标签: 1.2 内联标签: 2. 选择器 2.1 定义 2.2 选择器的分类 2.1 选择器的分类 3. css中margin, ...
- CSS3与页面布局学习笔记(五)——Web Font与CSS Sprites(又称CSS精灵、雪碧图)技术
一.web font web font是应用在web中的一种字体技术,在CSS中使用font-face定义新的字体.先了解操作系统中的字体: a).安装好操作系统后,会默认安装一些字体,这些字体文件描 ...
- CSS 概念 & 作用
http://www.cnblogs.com/moveofgod/archive/2012/09/18/2691101.html 式样定义 如何显示 HTML内容 通常存储在式样表中 作用 : 解 ...
- 字体在网页中画ICON图标
用字体在网页中画ICON图标有三种小技巧: 1.用CSS Sprite在网页中画小图标 实现方法: 首先将小图片整合到一张大的图片上 然后根据具体图标在大图上的位置,给背景定位.background- ...
- CSS 伪类 (Pseudo-classes)
CSS 伪类用于向某些选择器添加特殊的效果. CSS 伪类 (Pseudo-classes)实例: 超链接 本例演示如何向文档中的超链接添加不同的颜色. 超链接 2 本例演示如何向超链接添加其他样式. ...
随机推荐
- Web网站高并发量的解决方案
摘要: 一个小型的网站,可以使用最简单的html静态页面就实现了,配合一些图片达到美化效果,所有的页面均存放在一个目录下,这样的网站对系统架构.性能的要求都很简单.随着互联网业务的不断丰富,网站相 ...
- 剑指offer5 从尾到头打印链表
错误代码: class Solution { public: vector<int> printListFromTailToHead(ListNode* head){ vector< ...
- 安装JDK8
安装JDK8 1.去http://www.Oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html中下载JDK的 ...
- java8的4大核心函数式接口
//java8的4大核心函数式接口//1.Consumer<T>:消费性接口//需求:public void happy(double money, Consumer<Double& ...
- 设计模式——责任链(chain of responsibiltiy)
责任链模式在面向对象程式设计里是一种软件设计模式,它包含了一些命令对象和一系列的处理对象. 每一个处理对象决定它能处理哪些命令对象,它也知道如何将它不能处理的命令对象传递给该链中的下一个处理对象.也就 ...
- 键盘录入6个int类型的数据存入数组arr中,将arr数组中的内容反转...
一.有一道很有意思的数组操作相关编程题,闲来无事用JS解决了一下,问题描述如下: (1) 键盘录入6个int类型的数据存入数组arr中: (2) 将arr数组中的内容反转: (3) 将反转后的数组角标 ...
- cop2000实现补码两位乘
程序地址 机器码 反汇编语言 指令说明 ;IN 可以使用此指令在cop2000上输入数据 00 7C4B MOV A,#4BH 模拟输入X补 02 80 MOV R0,A 放入R0 03 88F9 M ...
- C++ ACM基础
一.C++结构体 #include <iostream> using namespace std; struct Point{ int x; int y; Point(int x=0,in ...
- hdu_5187_zhx's contest
Problem Description As one of the most powerful brushes, zhx is required to give his juniors n probl ...
- APSC4xSeries_Ver32.exe在win764位提示缺少DLL错误解决办法
APSC4xSeries_Ver32.exe在win764位提示缺少DLL错误解决办法 从网上下载oatime_epson-me1清零软件,Stylus4xProgram_Ver32的 解决办法:还是 ...