Reputation: 2208
This is my page
<div class="well">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-2 pull-right">
Hi | <span class="label label-info">Player</span> | <a href=""><span class="label label-danger">Logout</span></a><br><br>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-lg-7 col-lg-offset-7">
<a class="btn btn-primary btn-sm">Link 1 with big text </a>
<a class="btn btn-primary btn-sm">Link2 oktext</a>
<a class="btn btn-primary btn-sm">Linked text3</a>
<a class="btn btn-primary btn-sm">Linked text4</a>
<br><br>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-4">
<div class="thumbnail"><img src="http://lorempixel.com/400/300/"></div>
</div>
<div class="col-sm-4">
<div class="thumbnail"><img src="http://lorempixel.com/400/300/"></div>
</div>
<div class="col-sm-4">
<div class="thumbnail"><img src="http://lorempixel.com/400/300/"></div>
</div>
</div>
</div><br/>
</div>
Bootply with output
The problem i'm facing is, i can't make the buttons
(linked text4
)and logout
label align in a straight line even though i've used the pull-right
and offset
.
Upvotes: 3
Views: 2074
Reputation: 3615
Your pull-right is on the wrong element. It pulls the col-sm-2 and the col-lg-7 to the right as it should. To get the content of a div to the right you have to do text-right
.
Its easy to analyze with chrome dev tools.
<div class="col-sm-12">
<div class="row">
<div class="col-sm-2 text-right pull-right">
Hi | <span class="label label-info">Player</span> | <a href=""><span class="label label-danger">Logout</span></a><br><br>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-lg-7 pull-right text-right">
<a class="btn btn-primary btn-sm">Link 1 with big text </a>
<a class="btn btn-primary btn-sm">Link2 oktext</a>
<a class="btn btn-primary btn-sm">Linked text3</a>
<a class="btn btn-primary btn-sm">Linked text4</a>
<br><br>
</div>
</div>
</div>
As I see now, there is still a slightly difference, thats because .label
has an em padding and the btn-sm has an absolute padding. You have to switch to buttons for both or fix the padding via your custom.css, but this could mess up other label related displays.
Upvotes: 5