如何使 float:left 一直向左移动而不管前面元素的高度如何?
How to make a float:left go all the way left regardless of the height of the previous elements?
我想图片是不言自明的。这是处理浮动元素时的常见问题。谁有逼C一直往左走的绝招?
重要提示:
- 每个元素的高度由其内容决定。
- clear:left 不是一个选项,因为响应式设计会将布局转换为单列布局。
- 显示:table 出于同样的原因也不是一个选项
在这种情况下,最好使用 display: inline-block;
而不是 float:left;
内联块的行为既像块又像内联,因此行高将等于 "highest" 中的单词在这种情况下,行将是最高的块。
我想图片是不言自明的。这是处理浮动元素时的常见问题。谁有逼C一直往左走的绝招?
重要提示:
- 每个元素的高度由其内容决定。
- clear:left 不是一个选项,因为响应式设计会将布局转换为单列布局。
- 显示:table 出于同样的原因也不是一个选项
在这种情况下,最好使用 display: inline-block;
而不是 float:left;
内联块的行为既像块又像内联,因此行高将等于 "highest" 中的单词在这种情况下,行将是最高的块。