You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flexbox布局:如何调整Div顺序并实现移动端多行排列?

Flexbox 响应式布局实现方案

布局要求

  • 桌面端:Div one、Div two、Div three 三个元素在同一行排列
  • 移动端:Div one 与 Div two 并排显示,Div three 位于二者下方

桌面端实现代码

<div class="parent flex items-center justify-between">
  <div class="flex flex-1">Div one</div>
  <div class="flex flex-1 sm:order-last sm:flex-col">Div two</div>
  <div class="flex flex-1">Div three</div>
</div>

移动端实现代码

<div class="parent flex items-center justify-between">
  <div class="flex flex-1">Div one</div>
  <div class="flex flex-1">Div three</div>
  <div class="flex flex-1 sm:order-last sm:flex-col">Div two</div>
</div>

布局效果示意图

布局效果示意图

内容的提问来源于stack exchange,提问作者Denby101

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 14:05:12