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

HTML How to Make a Website CSS: Cascading Style Sheets Take a Mobile-First Approach

Sean Barry
Sean Barry
4,264 Points

Header 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?

om patel
om patel
738 Points

margin should be 0px also check if you have closed alls the stuff you have opened like header

Lasse Pedersen
Lasse Pedersen
2,395 Points

I 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
Alberto Medrano
12,917 Points

This 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

display: inline-bock; - is not working

  • margin: 0 auto; - is not working either

and im also having the same problem! my header is not centered!

Oana Giurgea
Oana Giurgea
Courses Plus Student 14,283 Points

The parent of id="logo" should have text-align: center;

I 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
Krissy Caron
4,311 Points

I am having the same issue, is there a bug in workspaces?

Oana Giurgea
PLUS
Oana Giurgea
Courses Plus Student 14,283 Points

The parent of id="logo" should have text-align: center; and id="logo" display: inline-block;