热门关键字:
jquery > jquery教程 > jquery教程 > 如何在Bootstrap中的DIV中左右对齐文本

如何在Bootstrap中的DIV中左右对齐文本

403
作者:管理员
发布时间:2021/2/8 14:26:28
评论数:0
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=3964
答:使用justify-content-between课程
您可以简单地将类.justify-content-between与类结合使用,.d-flex以在Bootstrap 4的容器中使文本内容左对齐和右对齐<div>。


让我们尝试以下示例以了解其基本工作原理:


例试试这个代码»
<div class="bg-light d-flex justify-content-between">
    <div>Total Cost</div>
    <div>$50</div>
</div>
如果您使用的是Bootstrap 3版本,则可以使用.pull-left和.pull-right类在同一DIV元素中左右对齐文本。另外,如果它不是网格列(即),请不要忘记将该类.clearfix应用于父类。这是一个例子:<div>.col-*


例试试这个代码»
<div class="bg-light clearfix">
    <div class="pull-left">Total Cost</div>
    <div class="pull-right">$50</div>
</div>




如果您觉得本文的内容对您的学习有所帮助:支付鼓励



关键字:jQuery
友荐云推荐