Brigitte Fellner Brigitte Fellner - 6 months ago 21
CSS Question

pull-left/right at the same height

I am using bootstrap and want to have two columns, one left, one right. The only problem is, it is not at the same height, but it should. I could do that with margin negative, but that doesn't feel right. I also found the class='clearfix', but that does not work. What is the solution of this easy problem?

HTML


<div class="span6 pull-left">
left some content here
</div>

<div class="span6 pull-right">
right content here
</div>


Answer

In Bootstrap, pull = float.

The problem here is that the span divs are too wide. When you float left and right, you will see this behavior if the width of the divs is greater than the width of the container.

In Bootstrap, you don't actually need to do this. If the width of your grid is 12, you can simply do what you've done, with two 6-width spans (no pulling or floating required).

<div class="span6">
  left some content here
</div>

<div class="span6">
  right content here
</div>