Is it possible to make CSS3 columns on a horizontal plane?

依然范特西╮ 提交于 2019-12-06 02:46:09

问题


I would like to know if it is possible to produce CSS3 columns horizontally.

for ex. if I have paragraphs a, b, c, and d and I give them "column-count: 2" the output would be

a c

b d

I would like to create the column so that the output would become

a b

c d

Does anyone know if this is possible while using css3 columns?

I'd prefer my page to be scalable and that's why I'd rather use columns so that the column-count would automatically produce the right amount of columns compared to the screen size.

The original page uses mostly 3-4 columns


回答1:


Giving the paragraphs a width and floating left should work if you specify a min/max width to the paragraphs. It should work with a variable width wrapper element but may break if you don't allow the paragraphs to scale much with restricted widths.

p {
    float: left;
    max-width: 160px;
    min-width: 100px;
    margin: 20px;
}

div { //wrapper
    width: 480px;
}

jsFiddle

Don't forget to clear the float in the element after the columns.



来源:https://stackoverflow.com/questions/14649919/is-it-possible-to-make-css3-columns-on-a-horizontal-plane

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!