使用 -moz/webkit 列宽 CSS 时,为什么我不能将多个帖子并排浮动?
在我正在设置的博客上, http://beerwhich.com/blogFun/index.html,我使用column-width属性来创建水平阅读体验。
问题:尽管浮动了两个帖子,但我似乎无法让多个帖子水平并排显示。
任何建议/知识将不胜感激!
On my blog that I am setting up, http://beerwhich.com/blogFun/index.html, I am using the column-width property to create a horizontal reading experience.
The problem: I cannot seem to get multiple posts to display horizontally next to each other despite floating both posts.
Any advice/knowledge would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
@肖恩;
column-width
属性没有问题,只需为您的.container div
(父 div)提供宽度,为child
div 腾出空间例如:
编辑:
正如您所说,您不想指定 div 的宽度。因此,也许您可以执行此
CSS:
检查示例 http://jsbin.com /oruyir/18 根据您的文本提供
column-count:
属性。@Sean; there is no problem with
column-width
property just give width to your.container div
(parent div) which make space forchild
divsFor example:
EDIT:
As you said that you don't want to specify width to your div's. So, may be you can do this
CSS:
check is example http://jsbin.com/oruyir/18 give
column-count:
property according to your text.您可以使用
column-count
和column-gap
代替并获得更好的结果,将其与box-flex
混合即可实现此设计相当好。这是一个快速而肮脏的演示
http://jsfiddle.net/andresilich/SvVGq/
You can use
column-count
andcolumn-gap
instead and get a better result, mixing it in withbox-flex
you can achieve this design quite nicely.Here's a little quick and dirty demo
http://jsfiddle.net/andresilich/SvVGq/
查看 http://css-tricks.com/ 166-how-to-create-a-horizontally-scrolling-site/ 有关如何使水平布局工作的教程。
如果您不需要它在 IE8 中工作,您可以尝试使用 CSS3 的灵活框模块 并在帖子项目上设置
box-orient:horizontal
而不是浮动它们。Check out http://css-tricks.com/166-how-to-create-a-horizontally-scrolling-site/ for a tutorial on how to make a horizontal layout work.
If you didn't need it to work in IE8, you could try using CSS3's Flexible Box module and set
box-orient: horizontal
on your post items instead of floating them.