Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Eric Kim
3,637 PointsHow can I centering main logo when I'm using bootstrap? (Guil Hernandez)
Currently I'm learning through Guil Hernandez's Framework Basics. I would like to make centered main logo. I searched on stack overflow, but none of them worked well.
This is my current navbar html and css.
<!--Navbar -->
div class="navbar navbar-default navbar-fixed-top">
div class="container">
a class="main-logo pull-left" href="#">Pozz </a
p class="navbar-text pull-right hidden-xs">Beta access </p
/div>
/div>
<!-- End navbar -->
.main-logo { width: 124px; height: 34px; margin-top: 16px; text-indent: 100%; white-space: nowrap; overflow: hidden; background: url('../img/main-logo.png') no-repeat; background-size: 100%; }
What should I change to make main-logo centered?
1 Answer
Steven Collins
Courses Plus Student 18,004 PointsHello, I think this is the way to do it. Here is the link. http://getbootstrap.com/css/#helper-classes-center
Center content blocks Set an element to display: block and center via margin. Available as a mixin and class.
<div class="center-block">...</div> // Classes .center-block { display: block; margin-left: auto; margin-right: auto; }
// Usage as mixins .element { .center-block(); }