[CSS3] Understand CSS Selector Specificity
It is hard to explain css selector specificty, to easy way to understand it is by playing around with it.
To remember some rules can be helpful:
- inline style > ID selector > Classes, attributes, and pseudo-classes > Elements and pseudop elements
Which means if you have inline style in your html, even you try to use ID selector, it cannot override the inline style. That's why people recommend don't use inline style because it is hard to override.
- If one combine selector A has more specificty than the other B, A will override B, even B comes later.

First one is the winner.
- If A and B has the same specificity, B comes later win.
- !Important overrides all the rest. This is the most powerful one, but again it is hard to override in the future if needed, recommended not to use it as much as possible.
[CSS3] Understand CSS Selector Specificity的更多相关文章
- Selenium - CSS Selector
Selenium - CSS Selector http://www.cnblogs.com/bugua/archive/2012/08/16/2641647.html 昨天我练习了用CSS(即层 ...
- css selector
文章一: http://www.jb51.net/css/68287.html 去年我学jQuery的时候,曾经做过一点选择器(selector)的笔记,今天是CSS的选择器,以后还有一部分xPath ...
- Selenium 使用css selector (资源来源于网络)
Selenium - CSS Selector 昨天我练习了用CSS(即层叠样式表Cascading Stylesheet) Selector来定位(locate)页面上的元素(Elements).S ...
- CSS selector All In One
CSS selector All In One CSS selector https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors ...
- [译文]通过ID, TagName, ClassName, Name, CSS selector 得到element
致谢原文: <http://xahlee.info/js/js_get_elements.html> 通过ID得到element: Document.getElementById(id s ...
- 转:Selenium之CSS Selector定位详解
CSS selector定位 CSS(Cascading Style Sheets)是一种语言,它被用来描述 HTML 和 XML 文档的样式. 百度输入框: <input name=&quo ...
- Scrapy学习系列(一):网页元素查询CSS Selector和XPath Selector
这篇文章主要介绍创建一个简单的spider,顺便介绍一下对网页元素的选取方式(css selector, xpath selector). 第一步:创建spider工程 打开命令行运行以下命令: sc ...
- Jsoup代码解读之五-实现一个CSS Selector
Jsoup代码解读之七-实现一个CSS Selector 当当当!终于来到了Jsoup的特色:CSS Selector部分.selector也是我写的爬虫框架webmagic开发的一个重点.附上一张s ...
- css selector: xpath:
css selector: $$(".mainLeft>div>h1") xpath: $x(".mainLeft>div>h1") n ...
随机推荐
- mysql随机获取数据
SELECT * FROM `table` AS t1 JOIN ( SELECT ROUND( RAND() * ( (SELECT MAX(id) FROM `table`) - (SELECT ...
- python 实现计算器功能 输入字符串,输出相应结果
import re formul='1 - 2 *( (6 0- 30+(0-40/5) * (9-2* 5/3 +7 /3*99/4*2998 +10 *568/14)) - (-4*3) / (1 ...
- 【LeetCode】Spiral Matrix(螺旋矩阵)
这是LeetCode里的第54道题. 题目要求: 给定一个包含 m x n 个元素的矩阵(m 行, n 列),请按照顺时针螺旋顺序,返回矩阵中的所有元素. 示例 1: 输入: [ [ 1, 2, 3 ...
- Java-转换Unicode和utf-8
package com.tj; import java.io.UnsupportedEncodingException; public class MyClass implements Cloneab ...
- 阿里云PolarDB及其共享存储PolarFS技术实现分析(下)
上篇介绍了PolarDB数据库及其后端共享存储PolarFS系统的基本架构和组成模块,是最基础的部分.本篇重点分析PolarFS的数据IO流程,元数据更新流程,以及PolarDB数据库节点如何适配Po ...
- jquery map.js
(function ($) { HashMap = function () { var index = 0; var content = ''; var keyV = new Array(); var ...
- 多线程下,多次操作数据库报错,There is already an open DataReader associated with this Command which must be closed first.
原文:https://www.cnblogs.com/sdusrz/p/4433108.html 执行SqlDataReader.Read之后,如果还想用另一个SqlCommand执行Insert或者 ...
- lamp环境配置,ubunutu下
Ubuntu下快速搭建LAMP环境过程记录: 安装 Apache2: sudo apt-get install apache2 安装PHP模块: sudo apt-get install php5 安 ...
- E. Lost in WHU。矩阵快速幂!
E. Lost in WHU 比赛的时候一直不知道样例怎么来的,然后和队友推了一下,然后还是没什么思路,样例手推很困难,然后我随口枚举了几个算法dp.广搜.快速幂.比赛结束问了谷队长结果真的是用快速幂 ...
- nodemailer发送邮件遇到的一些问题
使用nodemailer发送邮件一直困惑了我好几天,百度谷歌都没有找到的几个问题,方便大家排查. 我使用的是0.7.1版本,其他的版本好像报错,就没用. 错误信息:Mail from command ...