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

Design

Holly Holliday
Holly Holliday
1,563 Points

I can't make my headline text center. I'm missing something...

css:

a {
text-decoration:none;
}

#wrapper  {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 5%;
}

#logo {
  text-align: center;
  margin:0;
}

First part of html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <TITLE> Holly Holliday | Designer</TITLE>
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/main.css">
  </head>
  <body>
    <header>
      <a href="index.html"> id="logo">
    <h1>Holly Holliday</h1>
      <h2>Designer</h2>
        </a>
      <nav>
      <ul>
        <li><a href="index.html"class="selected">Portfolio</a></li>
        <li><a href="about.html">About</a></li>
        <li><a href="Contact.html">Contact</a></li>

Hi Holly,

Just formatted the code you posted so it's a little easier to read :)

You can do so by adding 3 backticks (```) on the line above and 3 on the line below the code.

-Rich

3 Answers

Hi Holly,

I think this line is your problem.

<a href="index.html"> id="logo">

You're closing the anchor tag before the id so it never gets referenced. Try removing the first >.

If that doesn't work you may also need to add display: block; to your style. Hope that helps :)

-Rich

geoffrey
geoffrey
28,736 Points

There are several errors in the code you posted. Here is the snippet of the code which is totally wrong.

 <a href="index.html"> id="logo">
    <h1>Holly Holliday</h1>
  <h2>Designer</h2>
  </a>

As you can see, you close in advance the anchor thar.

That should be this

<a href="index.html" id="logo"><!-- some other html--></a>

Secondly... No, nothing to say really ! I was about to tell It's bad practice to include block level element inside inline element such as anchors.

But It seems It's common when using HTML5...

Holly Holliday
Holly Holliday
1,563 Points

Thank you both. I will try. I was basically copying what the teacher said to do but it got fast. This is so new to me :(

geoffrey
geoffrey
28,736 Points

No worries, we are all beginners but at differents points. Keep it up ;) !

No problem and don't worry about making mistakes. The more you do it the easier it becomes :)

-Rich