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 trialSean Barry
4,264 PointsHeader text is not centering
html: <a href="index.html" id="logo"> <h1> Sean Barry </h1> <h2> Performer / Artist </h2> </a>
css: #logo { text-align: center; margin: 0; }
What am I doing wrong?
Lasse Pedersen
2,395 PointsI don't see anything obvious wrong with your code. Can you copy the code in from your files and mark it as code to make it readable?
Alberto Medrano
12,916 PointsThis part (section) of your code is fine. I copied it and tried it on my pc. It's okay. The problem may be elsewhere.
Try it on Atom, etc. It may be a workspaces error (bug).
5 Answers
aroshinemunasinghe
5,649 Pointsdisplay: inline-bock; - is not working
- margin: 0 auto; - is not working either
aroshinemunasinghe
5,649 Pointsand im also having the same problem! my header is not centered!
Oana Giurgea
Courses Plus Student 14,283 PointsThe parent of id="logo" should have text-align: center;
aroshinemunasinghe
5,649 PointsI have solve it out! Mine is working!! first, Check if you have coded correctly e.g have you close header tag ect. I dont know how your html code looks like but here is the answer
<header>
<a href="Index.html" id="logo"> /* HERE!! PUT ID HERE!!*/
<h1>YOUR NAME</h1>
<h2>Designer</h2>
</a>
<nav>
<ul>
<li><a href="Index.html" > Portfolio</a></li> /*NOT HERE*/
<li><a href="about.html"> About</a></li>
<li><a href="contact.html"> Contact</a></li>
</ul>
</nav>
Krissy Caron
4,311 PointsI am having the same issue, is there a bug in workspaces?
Oana Giurgea
Courses Plus Student 14,283 PointsThe parent of id="logo" should have text-align: center; and id="logo" display: inline-block;
Maria Sciortino
5,268 PointsTry margin: 0 auto;
om patel
738 Pointsom patel
738 Pointsmargin should be 0px also check if you have closed alls the stuff you have opened like header