右揃え (デフォルトは左揃え) には、スパンで text-align:right を使用できます。これをレスポンシブにするには、メディア クエリを使用して大画面にのみ適用します。
@media (min-width:768px)
{
.text-right-responsive {text-align:right;}
.text-left-responsive {text-align:left;}
}
html:
<div class="container">
<div class="row">
<div class="span6 text-right-responsive">A (right-aligned)</div>
<div class="span6 text-left-responsive">B (left-aligned)</div>
</div>
</div>
参照: https://stackoverflow.com/a/14809431/1596547バージョン 2.3 以降 Twitter の Bootstrap にも text-* クラスがあります。したがって、次を使用できます<div class="span6 text-right">A (right-aligned)</div>
。また、このクラスはレスポンシブではありません。text-right は、要素のスタイルに text-align:right を追加するだけです。したがって、これもリセットするにはメディアクエリが必要です。小さな画面のテキストの配置をリセットします。
@media (max-width:767px)
{
.text-right {text-align:left;}
.text-left {text-align:left;}
}
pull-right / pull-left クラスは要素に float を追加します。したがって、それらを使用するには、追加のラッパーが必要になります。
<div class="container">
<div class="row">
<div class="span6"><span class="pull-right">A (right-aligned)</span></div>
<div class="span6"><span class="pull-left">B (left-aligned)</span></div>
</div>
</div>
この場合、メディアクエリも使用できます。ここで、小さな画面のフロートをリセットする必要があります。
@media (max-width:767px)
{
.pull-right {float:none;}
.pull-left {float:none;}
}
デモ: http://bootply.com/66024