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 Layout Basics CSS Layout Project Adding Media Queries for Large Screens

Alexey Kulikov
Alexey Kulikov
11,124 Points

Using inline-blocks in header instead of floats

Hi!

I've tried to imlement the header using inline-blocks for positioning .main-nav and .name and faced with the following problem. It's easy to place .main-nav and .name on the same line next to each other with inline-block. But what is the best way to align them to the right and left side of the page respectively?

My solution:

.name {
    display: inline-block;
    width: 30%;
    text-align: left;
}

.main-nav {
    display: inline-block;
    width: 70%;
    text-align: right;
}

It works, but i'am not sure if it is the best way to align inline-blocks to the right and left sides of the page. Do you know a beter way or my solution is good enough?

1 Answer