如何使用Twitter Bootstrap在右上角放置div [英] How to place a div in the top right corner using Twitter Bootstrap

查看:168
本文介绍了如何使用Twitter Bootstrap在右上角放置div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图得到一个包含如下内容的div:
$ b

I'm trying to get a div that contains something like:

You're logged as 'username' (<a href='logout.php'>logout?</a>)

但是当我试图把它放在它的标题下时。这里是我的代码,试着做这个工作。

But when I try to put it in it gets placed beneath my header. Here's my code to try and make this work.

<body>
    <div class="container">
        <div class="row">
            <span6>
                <h1><a href="#">My Header</a></h1>
            </span6>
            <span6>
                <p class="text-right">
                    You're logged in as username (<a href='logout.php'>logout?</a>)
                </p>
            </span6>
        </div>
    </div>
</body>

这会让注销部分出现在右侧,但它会出现在标题下方我希望它与头部位于同一个垂直位置。

This get the logout section to appear on the right side as I want but it appears below the header whereas I'd like for it to be on the same vertical position as the header.

推荐答案

您需要让span6成为一个类一个包含在行中的div

You need to make span6 a class on a div which is contained in a a "row"

BootStrap

<div class="row">
  <div class="span9">
    Level 1 column
    <div class="row">
      <div class="span6">Level 2</div>
      <div class="span3">Level 2</div>
    </div>
  </div>
</div>

这篇关于如何使用Twitter Bootstrap在右上角放置div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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