Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] 第96天 行内css和important哪个优先级高? #963

Open
haizhilin2013 opened this issue Jul 20, 2019 · 7 comments
Open

[css] 第96天 行内css和important哪个优先级高? #963

haizhilin2013 opened this issue Jul 20, 2019 · 7 comments
Labels
css css

Comments

@haizhilin2013
Copy link
Collaborator

第96天 行内css和important哪个优先级高?

@haizhilin2013 haizhilin2013 added the css css label Jul 20, 2019
@LinStan
Copy link

LinStan commented Jul 21, 2019

!important 将覆盖行内css
css优先级:行内css>id选择器(#)>伪类(:)>属性选择器([])>类选择器(.) > 类型选择器(div p a等) > 通用选择器(*)

@NicholasBaiYa
Copy link

!important 是最高级的吧

@haizhilin2013
Copy link
Collaborator Author

haizhilin2013 commented Jul 21, 2019

!important

@l8888888
Copy link

css 权重(以256进制计算)
!important Infinity
行间样式 1000
id 100
class/伪类/属性 10
元素/伪元素 1
通配符(*) 0

@Konata9
Copy link

Konata9 commented Aug 20, 2019

!important 优先级最高,权重可以认为是正无穷。

CSS 选择器的优先级:
!important > 行内 > #id > .class > tag > *

@seho-dev
Copy link

特指度
ICE公式

@maxthonl
Copy link

<div style="background-color: violet !important;"></div>

鸡贼点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

7 participants