【发布时间】:2017-01-25 21:00:11
【问题描述】:
我有三个 div 左 - 中 - 右,如果文档在移动设备中打开,我需要,
在一行中显示左右元素,并在它们下方显示中心元素
我需要:
a) PC
[left] [ long text in center ] [right]
b) PC smaller screen !impartant!
[left] [ long text [right]
in center ]
c) Mobile (smaller then 736px )
[left] [right]
[ text in center ]
我找到了 (a) 和 (c) 情况的解决方案,但它不适用于中间情况 (b)
看:http://jsfiddle.net/66fCm/692/
.wrap {
text-align: center
}
.left {
float: left;
background: grey
}
.right {
float: right;
background: red
}
.center {
text-align: left;
background: green;
margin: 0 auto !important;
display: inline-block
}
<div class="wrap">
<div class="left">
left
</div>
<div class="right">
right
</div>
<div class="center">
center | Far far away, behind the word mountains, far from
</div>
</div>
【问题讨论】:
-
我需要所有三种情况(a、b 和 c),每种情况都适用于不同的屏幕尺寸