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

CSS

CSS Styling Question

How to I get the menu and logo to align besides each other in the header. I never understand this well.

For example: http://www.midnightpencils.com/style.png

3 Answers

You will need to use the css layout for;

.class {
 display: inline;
}

Check out this basic example.

What code to use to give it some space off the top?

I'm not sure how you're code looks, but you can use Padding-Top: 1px; or Margin-Top: 1px; I'm not sure what it is you're exactly doing, so you'll have to decide what suites it best.

Do you want your logo on the left side and navigation pane on right, both being vertically aligned? In that case try...

<header>
  <div id="logo">
  <!-- your code -->
  </div>
  <nav>
    <!-- your menu elements -->
  </nav>
</header>

and

#logo {
  float left;
}

nav {
  float: right;
  display: inline-block;
}

That is of course only ONE way to do it.

You should also read this article: Left Half and Right Half Layout