【发布时间】:2017-11-06 01:56:29
【问题描述】:
我目前正在开发 HTML 布局的移动版本,并且我正在尝试更改移动版本的 div 的 div 顺序。以下是桌面版的设置(div 的顺序):
以下是我尝试过的代码。上图中的 div#4 没有低于 & div#5 没有出现。谁能指出我在这里遗漏了什么以及为什么代码不起作用? 您的帐户
<div id="logo" class="row">
<div class="col text-center" style="background-color:#0471AF; height:100px; display: flex; justify-content: center;">
LOGO
</div>
</div>
<!-- /.logo -->
<div id="order-text" class="row">
<div class="col text-center" style="min-height: 98px; vertical-align:middle; font-family:Helvetica, Arial, sans-serif; font-size:36px; color: #0471AF; font-weight:100; display: flex; justify-content: center;">
<span style="align-self: center;">Heading Text</span>
</div>
</div>
<!-- /.order-text -->
<div class="row">
<div id="left-side-text" class="col-md-8 col-sm-12" style=" line-height: 18px;">
<span style="vertical-align:top; font-family:Helvetica, Arial, sans-serif; font-size:14px; color: #333333; text-decoration: none; text-align: left; line-height: 18px; font-weight:100;">
Dear XYZ,
</span>
<br>
<br>
<span style="font-family:Helvetica, Arial, sans-serif; font-size:17px; text-decoration: none; text-align:left; padding-bottom:20px;">Good news! Your order is confirmed.</span>
<br>
<br>
<span style="vertical-align:top; font-family:Helvetica, Arial, sans-serif; font-size:14px; color: #333333; text-decoration: none; text-align: left; font-weight:100;">
Some other text
</span>
</div>
<!-- /.left-side text -->
<div id="order-information" class="col-md-4 col-sm-12 order-2">
<div class="col" style="height: 43px; vertical-align:middle; font-family:Helvetica, Arial, sans-serif; font-size:16px; color: #333333; text-decoration: none; font-weight:700; background: #f2f2f2; padding: 10px; border: 1px solid #999999; border-bottom: none;">
Order Details
</div>
<div class="col" style="font-family:Helvetica, Arial, sans-serif; font-size:12px; color: #333333; padding: 10px; height: 73px; border: 1px solid #999999; border-top: none;">
<table>
<tr>
<td class="col-2 font-weight-bold" style="padding-bottom: 10px; padding-left: 0">Order Date:</td>
<td class="col-2" style="padding-bottom: 10px; padding-left: 0">03/06/2016</td>
</tr>
<tr>
<td class="col-2 font-weight-bold" style="padding: 0px;">Order #:</td>
<td class="col-2" style="padding-bottom: 10px; padding-left: 0">123456789</td>
</tr>
</table>
</div>
</div>
<!-- /.order-information -->
</div>
<div id="confirmation-email" class="row order-1">
<div class="col-md-11 col-sm-12" style="line-height: 18px; vertical-align:top; font-family:Helvetica, Arial, sans-serif; font-size:14px; color: #333333; text-decoration: none; text-align: left; font-weight:100;">
<br>
<br>Text1
<br>
<br> Text
<br> Text
</div>
</div>
【问题讨论】:
-
to
order工作其父元素需要类d-flex -
@Hareesh 你能告诉我我应该将 d-flex 类应用到哪个类吗?
-
你不能使用这种布局,你的最后一个元素 5th div 放置在上面包含你的 4th div 的行之外。
-
@Hareesh 哎呀!我刚刚注意到了!感谢您指出了这一点!我已经在行 div 中移动了第 5 个 div,订单现在按预期工作!谢谢!
-
您只需要指定每个屏幕的列顺序,然后将所有列连续排列,请参阅链接:codepen.io/ziruhel/pen/qVNdBP 下面我将详细信息代码作为答案,请看看,我想这就是你想要的。
标签: html twitter-bootstrap bootstrap-4