Comments (1)
有其他优先级更高的样式覆盖了这个样式
-
内联样式表的权值最高 1000;
-
ID 选择器的权值为 100
-
Class 类选择器的权值为 10
-
HTML 标签选择器的权值为 1
5 继承样式的权值为0.1(某些论文提出,但毫无疑问它的权值是最低的)
css优先级:!important
> 内联 > id选择器 > 类选择器 > 元素选择器
选择器都有一个权值,权值越大优先级越高。
假设内联的权值为 1000
,id100
,类 10
,元素 1
.nav-wrap ul li
的权值为 10+1+1=12
.line-active
的权值为 10
所以 .nav-wrap ul li
比 .line-active
有更高的优先级
from awesome-frontend-interview.
Related Issues (20)
- 如何判断一个对象是否为函数
- CSS 实现垂直居中水平居中
- Flash 和 JavaScript 通过什么类如何交互? HOT 1
- JavaScript 保留关键字有哪些 HOT 1
- 变量作用域 求下面代码输出
- XMLHttpRequest 请求后 返回值有哪些 HOT 1
- 手写一个 get post 请求方法 HOT 1
- vue 中的 钩子是干嘛用的, 有哪些钩子函数 HOT 3
- 常用的 Javascript 设计模式 HOT 1
- vue 双向绑定数据原理
- link与@import 的区别 HOT 1
- css 实现文本溢出隐藏 HOT 1
- 如何判断一个变量是对象还是数组? HOT 1
- Javascript 实现 金额补全 HOT 1
- 一个有味道的函数 HOT 1
- 浏览器多个标签的通信 HOT 4
- html 实现 http 跳转 https HOT 1
- 纯CSS 多行文本溢出省略号 HOT 4
- Action required: Greenkeeper could not be activated 🚨
- 删除排序数组中的重复项 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome-frontend-interview.