I want some elements on my page to align to the center and right, but the bootstrap classes 'text-right' and 'text-center' don't seem to work, even though 'text-left' does.

Thanks.

<div> <div> <div> <div> <div> <a href="/"><img src="/stylesheet/main_logo.png" ></a> </div> <div> <ul> <li> <a href="#" aria-expanded="false"> <span></span> Account <span></span> </a> <ul> <li> <a href="/account/">Your Account</a> </li> <li> <a href="/profile/">Profile</a> </li> <li> <a href="/shop/reviewbasket/">Basket</a> </li> </ul> </li> </ul> </div> <div> <div> </div> </div> </div> </div> </div> </div> 
3

2 Answers

For those using Bootstrap 5 be aware that text-left and text-right classes have been removed. Now you can use text-start and text-end.

5

Bootstrap 5 - Update 2022

As explained here, left & right have been replaced with start & end in Bootstrap 5...

  • use float-end on a block elements (ie: div)
  • use text-end on inline elements (ie: a, span)

Bootstrap 4 - Update 2018

pull-right has changed to float-right

Bootstrap 3 - Original Answer

The original question was for Bootstrap 3 and the problem was that the OP was attempting to use text-right on a block element. text-right only works on inline elements. UL is a block element so you'd use pull-right like this..

<div> <ul> ... 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy