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] 第74天 说说你对!important的理解,一般在哪些场景使用? #518

Open
haizhilin2013 opened this issue Jun 28, 2019 · 4 comments
Labels
css css

Comments

@haizhilin2013
Copy link
Collaborator

第74天 说说你对!important的理解,一般在哪些场景使用?

@haizhilin2013 haizhilin2013 added the css css label Jun 28, 2019
@xiangshuo1992
Copy link
Contributor

!important 可以让样式的特指度最高,覆盖任何样式,而且本身不可被覆盖。
一般场景就是用来强制覆盖其他样式,用的比较少,不建议使用,因为别人没法覆盖这个样式,维护性比较。

@forever-z-133
Copy link

使用场景好像几乎没有,还是调整权重比较好。

@smile-2008
Copy link

!important 可以让样式的特指度最高,覆盖任何样式,而且本身不可被覆盖。
一般场景就是用来强制覆盖其他样式,用的比较少,不建议使用,因为别人没法覆盖这个样式,维护性比较。

@dugufck666
Copy link

  .heart {
    position: relative;
    width: 100px !important;
    height: 90px !important;
  }
  .heart {
    width: 200px !important;
    height: 200px !important;
  }

important声明在后面的会覆盖前面的,谷歌浏览器中表现是这样

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

5 participants