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

有哪几种常用的清除浮动方法? #3

Open
artdong opened this issue Jul 8, 2019 · 1 comment
Open

有哪几种常用的清除浮动方法? #3

artdong opened this issue Jul 8, 2019 · 1 comment
Labels
css css

Comments

@artdong
Copy link
Collaborator

artdong commented Jul 8, 2019

有哪几种常用的清除浮动方法?

@artdong artdong added the css css label Jul 8, 2019
@FunnyZ
Copy link
Collaborator

FunnyZ commented Jul 8, 2019

  • 父级元素添加伪元素
.clear-float:after {
    content: '';
    display: block;
    clear: both;
}
  • 在与浮动元素平级的最后面添加新元素 div.clear
.clear {
    clear: both;
}
  • 在父级元素添加样式 overflow: auto; 或者 overflow: hidden; 会存在兼容性问题。

@artdong artdong added this to done in fe-interview Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
Development

No branches or pull requests

2 participants