[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 ...
随机推荐
- 【linux】【git】git报错fatal: HTTP request failed
在使用git pull.git push.git clone会报类似如下的错误: error: The requested URL returned error: 401 Unauthorized w ...
- js对象,数组,字符串的操作
循环绑定=>变量污染 for (var i = 0;i<lis.length;i++){ lis[i].index = i;#给页面元素对象添加一个任意属性(保留索引的属性index) # ...
- The North American Invitational Programming Contest 2018 D. Missing Gnomes
A family of nn gnomes likes to line up for a group picture. Each gnome can be uniquely identified by ...
- 关于springmvc返回json格式数据
1.引入maven依赖 <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifac ...
- Java设计模式学习二
Java设计思想之单例模式 单例模式(Singleton Pattern)是Java中最常见的设计模式之一.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. 这种模式涉及到一个单一的 ...
- 用python计算100以内的素数
用python计算100以内的素数 : break else: list.append(i)print(list)
- 在 Yii2 项目中使用 Composer 添加 FontAwesome 字体资源
2014-06-21 19:05 原文 简体 繁體 2,123 次围观 前天帮同事改个十年前的网站 bug,页面上一堆 include require 不禁让人抱头痛哭.看到 V2EX 上的讨论说,写 ...
- 集群高可用之lvs+keepalive
集群高可用之lvs+keepalive keepalive简介: 负载均衡架构依赖于知名的IPVS内核模块,keepalive由一组检查器根据服务器的健康情况动态维护和管理服务器池.keepalive ...
- iOS学习笔记19-地图(一)定位CoreLocation
一.定位介绍 现在很多社交.电商.团购应用都引入了地图和定位功能,似乎地图功能不再是地图应用和导航应用所特有的.的确,有了地图和定位功能确实让我们的生活更加丰富多彩,极大的改变了我们的生活方式.要实现 ...
- 【bzoj4605】崂山白花蛇草水 权值线段树套KD-tree
题目描述 神犇Aleph在SDOI Round2前立了一个flag:如果进了省队,就现场直播喝崂山白花蛇草水.凭借着神犇Aleph的实力,他轻松地进了山东省省队,现在便是他履行诺言的时候了.蒟蒻Bob ...