html - 如果下面没有空间,则 float div

标签 html css

假设我有 3 个 div。我希望它们堆叠成列,彼此相邻。在第一列中,前两个 div 适合。现在我想让第三个放在第一个旁边,因为第三个没有空间放在前两个下面。如何做到这一点?

enter image description here

enter image description here

最佳答案

目前,唯一可靠的方法是使用 CSS3 的列。请参阅此处以获取引用:http://www.css3.info/preview/multi-column-layout/

这还没有得到广泛支持(尤其是 IE),因此您可能需要 jQuery 插件 Columnizer 来添加更多支持: http://dotmac.rationalmind.net/2011/03/cross-browser-multi-columns-with-jquery-and-css3/

关于html - 如果下面没有空间,则 float div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10417885/

相关文章:

html - Angular 2 : how to clear the dropdown and textbox values while switching the radio buttons

java - 什么 html 解析器能够处理编码?

javascript - 如何分解长单词而忽略短单词?

javascript - 将 div 直接放在页脚上方

css - Bootstrap 3 旋转木马导航器事件类未更新

html - 将自定义图标放在 Bootstrap 按钮内

html - 我似乎无法重命名/更改某些 CSS 类

javascript - 我如何在不使用 id 的情况下制作动态 css 类?

html - MVC3网站如何应用StyleSheet?

html - 单击时按钮应具有不同的颜色,但该页面上所有按钮的颜色都会更改