移动友好的CSS多列布局不吸弯曲状 [英] mobile friendly CSS multi column layout that doesn't suck like flex

查看:194
本文介绍了移动友好的CSS多列布局不吸弯曲状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了一个柔性多列布局,有它在我的桌面上看起来棒极了,然后看着它在移动设备上,它是完整的垃圾(所有scruntched在一起,全然不顾宽度参数)。
用它玩过几个小时,我到处去在互联网上表示,柔性吸的移动设备。不能被砍死正确的。

I implemented a flex multi column layout, got it to look great on my desktop, then looked at it on a mobile device and it was complete trash (all scruntched together, ignoring width parameters completely). Played with it for hours and everywhere I went on the internet said flex sucked for mobile devices. Can't be hacked correct.

我试图打栏,但文字横跨它的自我,以它自己的下一个列​​,它不会为我的的jsfiddle列code (注:该位置调试的字符串,它抛出它的自我到第3列,其中很清楚在HTML中,我有它在第一列的定义,内结束

I tried playing with columns, but text spans it's self to a next column on it's own, which will not work for me JSFiddle column code (note: the position of the "DEBUG" string, it throws it's self into the 3rd column where very clearly in the HTML, I have it defined in the first column, within the closing

</div>

什么是移动设备的一个体面的CSS多栏布局,限制内容到特定列?

What is a decent CSS multi-column layout for mobile devices that restricts content to a specific column?

推荐答案

您可以通过将您的内容在三个div的有你的内容有更多的控制,然后使用CSS来定义你的div(列)的宽度和利润。

You can have more control of your content by placing your content in three divs and then use CSS to define the width and margins of your divs (columns).

例如,这可能是你的CSS:

For Example this could be your CSS:

.oneThird {
    float: left;
    margin-right: 2%;
    width: 32%;
}
.gridLast {
    margin-right: 0;
}

和这是你的HTML:

<div class="oneThird">
    <p>Column Content 1</p>
</div>
<div class="oneThird">
    <p>Column Content 2</p>
</div>
<div class="oneThird gridLast">
    <p>Column Content 3</p>
</div>

下面是一个的jsfiddle:
http://jsfiddle.net/wsqLagfu/ ​​

Here is a JSFiddle: http://jsfiddle.net/wsqLagfu/

我希望这是你所需要的。

I hope this is what you need.

这篇关于移动友好的CSS多列布局不吸弯曲状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆