我需要将一行分成两行,以便我可以连续容纳两个标题,如下所示:
使用我编写的当前代码,我无法像上面那样将行分成两行,也无法像下面那样保持响应:
下面是代码:
<div class="container-fluid mail-body" style="width: 740px;">
<div id="account" class="row your-account">
<div class="col text-right" style="line-height: 20px; height: 20px; color:#004990; text-decoration:none; font-family:Helvetica, Arial, sans-serif; font-size:10px;">
Your Account
</div>
</div>
<!-- /.your-account -->
<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 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>
<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>
<div class="row">
<div class="col-md-12" >
<div class="col" style="height: 36px; vertical-align:middle; font-size: 12px; font-family:Helvetica, Arial, sans-serif; color: #333333; text-decoration: none; font-weight:700; background: #f2f2f2; padding: 10px; border: 1px solid #999999; border-bottom: none;">
<span class="">Product(s) Ready for Pickup</span>
<span class="text-right">Quantity</span>
</div>
</div>
</div>
请帮助我正确设置html以及bootstrap类,以达到预期的效果。 谢谢!
答案 0 :(得分:1)
这是超级简单/干净的代码:
<div class="row">
<div class="col" >
Product(s) Ready for Pickup
</div>
<div class="col text-right" >
Quantity
</div>
</div>
答案 1 :(得分:0)
您需要使用col-sm-6
(或根据设备需要的相关类)在您的行中创建两列。假设你需要为小型,中型,大型设备提供 2列行,对于超小型设备需要 1列,以下是我的建议(注意:我已删除了样式提高可读性的规则。)
<div class="row col-md-12">
<div class="col-xs-12 col-sm-6" >
<span class="float-left">Product(s) Ready for Pickup</span>
</div>
<div class="col-xs-12 col-sm-6" >
<span class="float-right">Quantity</span>
</div>
</div>
答案 2 :(得分:0)
使用col-xl- {value}来获取列。 Bootstrap Grid http://getbootstrap.com/docs/4.0/layout/grid/
<div class="row"> //row
<div class="col-xs-6" > //column 1 for extra large screen, use sm for small, md for medium screen
<span>Product(s) Ready for Pickup</span>
</div>
<div class="col-xs-6" > //column 2
<span>Quantity</span>
</div>
</div>
答案 3 :(得分:0)
您可以对父行类中的子元素使用 col-md - * 类来拆分您需要的列。
<div class="row">
<div class="col-md-9" >
Product(s) Ready for Pickup
</div>
<div class="col-md-3 text-center" >
Quantity
</div>
</div>