在Bootstrap 3中右对齐div [英] Align div right in Bootstrap 3

查看:1172
本文介绍了在Bootstrap 3中右对齐div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Bootstrap 3右对齐一个div?



我知道偏移的可能性,但我想对齐格式化的div在右边它的容器,而它应该在一个全宽移动视图中心。类'pull-right'不再工作了。他们忘了替换它,还是我缺少一些明显的东西?

 < div class =row 
< div class =container>
< div class =col-md-4>
left content
< / div>
< div class =col-md-4 col-md-offset-4>
<! - 下一个div有一个背景颜色和自己的paddings,应该右对齐 - >
<! - 它现在在右侧列,但在该列中左对齐 - >
< div class =yellow_background>正确内容< / div>
< / div>
< / div>
< / div>

我知道如何在CSS中做到这一点,但它可以在纯bootstrap 3? / p>

解决方案

Bootstrap中的类右下角仍然存在3
参见'helper classes'here



右键由


定义

  .pull-right {
float:right!important;
}

没有更多关于样式和内容的信息,很难说。 >

这个 JSBIN
中的页面比990px​​宽,这是col-md造型,
Bootstrap 3移动优先和所有。


Is there a way in Bootstrap 3 to right align a div?

I am aware of the offsetting possibilitys but I want to align a formatted div to the right of its container while it should be centered in a fullwidth mobile view. The class 'pull-right' is not working anymore. Did they forgot to replace it or am I missing something obvious?

<div class="row">
  <div class="container">
    <div class="col-md-4">
      left content
    </div>
    <div class="col-md-4 col-md-offset-4">
      <!-- The next div has a background color and its own paddings and should be aligned right-->
      <!-- It is now in the right column but aligned left in that column -->
      <div class="yellow_background">right content</div>
    </div>
  </div>
</div>

Shure I know how to do this in CSS, but can it be done in pure bootstrap 3?

解决方案

The class pull-right is still there in Bootstrap 3 See the 'helper classes' here

pull-right is defined by

.pull-right {
  float: right !important;
}

without more info on styles and content, it's difficult to say.

It definitely pulls right in this JSBIN when the page is wider than 990px - which is when the col-md styling kicks in, Bootstrap 3 being mobile first and all.

这篇关于在Bootstrap 3中右对齐div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆