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
Jordan Winters
Front End Web Development Techdegree Student 10,360 PointsBootstrap first try Title not centering
I used <div class="container text-xs-center"> to center my main header and it keeps floating left. Any ideas why? I'm sure I'm just missing something little... Thanks for the help!
Here is my HTML:
<!DOCTYPE html> <html lang="en"> <head> <title>Full Stack Conf</title> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head> <body>
<div class="container text-xs-center">
<h1 class="display-1">Full Stack Conf</h1>
<p class="lead">Coming Soon, a One-day Conference About All Things JavaScript!</p>
<div class="col-lg-6 offset-lg-3">
<div class="input-group">
<input type="text" class="form-control" placeholder="Enter your email for info...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Sign Up</button>
</span>
</div>
</div>
</div>
<!-- jQuery first, then Tether, then Bootstrap JS. -->
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</body> </html>
2 Answers
martinjones1
Front End Web Development Techdegree Graduate 44,824 PointsHi,
I just tested this using Google Chrome Developer Tools and the text-xs-center class does not appear to exist in Bootstrap 4.
You could change it to text-center, and if you want to change the alignment on larger screens, add the responsive classes for sm, md, lg and xl.
nagamani palamuthi
6,160 PointsTry <div class = "mx-auto">