Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text in Bootstrap footer aligning to center

The footer in my webpage is aligned to the center.

<div id="footer">
  <div class="container">
    <p class="text-muted credit" style="color:#fff">xyz</p>
  </div>
</div>

This code works perfectly for other pages but for this particular page it doesn't work. This page contains a fullcalender UI that I have plugged but I doubt that has anything to do with my issue.

like image 401
Prajeeth Emanuel Avatar asked Dec 09 '13 22:12

Prajeeth Emanuel


People also ask

How do I center text in a footer in Bootstrap?

Add class . text-center to the parent div to align text or any item inside to the center. You can also decide how the alignment should look like on the specific screen sizes.

How do I center align a text box in Bootstrap?

use container class of bootstrap. For Bootstrap use justify-content-center.

How do I align footer Content Center in HTML?

HTML | <tfoot> align Attribute left: It sets the table footer text left-align. right: It sets the table footer text right-align. center: It sets the table footer text center-align.


2 Answers

Try adding the "text-center" class to the container. So you will end up with this:

<div id="footer">
  <div class="container text-center">
    <p class="text-muted credit" style="color:#fff">xyz</p>
  </div>
</div>

See if that works. Otherwise, maybe paste your markup for the page so that we can look at it. It would also be helpful if you inspected the footer element with chrome for example and attached the screenshot of it.

like image 165
AJ Meyghani Avatar answered Oct 12 '22 13:10

AJ Meyghani


For me with Bootstrap 3 don't forget to specified col-md-12 col-sm-12 and col-xs-12 to work.

Other things avoid using style="color:#fff" it breaks color theme. Use navbar-text instead. So you should have something like this :

<nav class="navbar navbar-default  navbar-fixed-bottom" role="navigation">
    <div class="container text-center">
        <p class="navbar-text col-md-12 col-sm-12 col-xs-12">&copy; xyz</p>
    </div>
</nav>

Last word, use container and not container-fluid

like image 42
jr from Yaoundé Avatar answered Oct 12 '22 13:10

jr from Yaoundé