4

我有一个连续的<h1>标题<div>。我想完全扩展<h1>样式,但在行的右侧放置一个按钮。

我无法弄清楚如何<span>正确设置值以使按钮保持在右侧,但也扩展了行的全部数量。

我唯一的想法是将<h1>a 放在 a 中div .span6,然后将按钮放在另一个向右拉的位置,但这会在标题样式和按钮div span之间留下难看的空白。<h1>

如果我们在右侧有 2 个按钮,它也需要流畅。

这只是我尝试做的一个示例。

4

1 回答 1

8

Your original question was a bit unclear, so I had to guess if something like this was what you were after.

<div class="container">
  <div class="row">
    <a href="#" class="btn pull-right">Button 2</a>
    <a href="#" class="btn pull-right">Button 1</a>
    <h1>My fancy title</h1>
  </div>
</div>

After you edited the jsfiddle example, I'd say that my solution should work if you're using bootstrap. For some reason your css has .pull-right{float:none;} in it that's causing pull-right not to work.

Here's a simple demonstration of your code with only changes being the button being before the h1 and .pull-right{float:right;} added to the end of css

http://jsfiddle.net/Arkkimaagi/KFsM6/1/

于 2012-06-06T14:58:22.913 回答