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

Why are my boxes not aligning?

I put red boxes around the area in question. I can't figure out why "Best City Guide" and the nav links aren't center aligned with each other.

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Best City Guide</title>
    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>

    <header class="main-header">
    <div class="clearfix container">
        <h1 class="name"><a href="#">Best City Guide</a></h1>
        <ul class="main-nav">
            <li><a href="#">ice cream</a></li>
            <li><a href="#">donuts</a></li>
            <li><a href="#">tea</a></li>
            <li><a href="#">coffee</a></li>
        </ul>
    </div>
    </header><!--/.main-header-->   

    <div class="banner">
        <img class="logo" src="img/city-logo.svg" alt="City">
        <h1 class="headline">The Best City</h1>
        <span class="tagline">The best drinks and eats in the best city ever.</span>
    </div><!--/.banner-->

  <div class="clearfix container">
    <div class="secondary col">
    <h2>Welcome!</h2>
        <p>Everything in this city is worth waiting in line for.</p>
        <p>Cupcake ipsum dolor sit. Amet chocolate cake gummies jelly beans candy bonbon brownie candy. Gingerbread powder muffin. Icing cotton candy. Croissant icing pie ice cream brownie I love cheesecake cookie. Pastry chocolate pastry jelly croissant.</p>
        <p>Cake sesame snaps sweet tart candy canes tiramisu I love oat cake chocolate bar. Jelly beans pastry brownie sugar plum pastry bear claw tiramisu tootsie roll. Tootsie roll wafer I love chocolate donuts.</p>
    </div><!--/.secondary-->

    <div class="primary col">
        <h2>Great food</h2>
        <img class="feat-img" src="img/treats.svg" alt="Drinks and eats">
        <p>Croissant macaroon pie brownie. Cookie marshmallow liquorice gingerbread caramels toffee I love chocolate. Wafer lollipop dessert. Bonbon jelly beans pudding dessert sugar plum. Marzipan toffee drag&#233;e chocolate bar candy toffee pudding I love. Gummi bears pie gingerbread lollipop.</p>
    </div><!--/.primary-->

    <div class="tertiary col">
        <h2>How to get here</h2>
        <p><strong>Plane: </strong>Tiramisu caramels gummies chupa chups lollipop muffin. Jujubes chocolate caramels cheesecake brownie lollipop drag&#233;e cheesecake.</p>
        <p><strong>Train: </strong>Pie apple pie pudding I love wafer toffee liquorice sesame snaps lemon drops. Lollipop gummi bears dessert muffin I love fruitcake toffee pie.</p>
        <p><strong>Car: </strong>Jelly cotton candy bonbon jelly-o jelly-o I love. I love sugar plum chocolate cake pie I love pastry liquorice.</p>
    </div><!--/.tertiary--> 

    </div>

    <footer class="main-footer">
        <span>&copy;2015 Residents of The Best City Ever.</span>
    </footer>

</body>
</html>
/* ================================= 
  Base Element Styles
==================================== */

* {
    box-sizing: border-box;
}

body {
    font-family: 'Varela Round', sans-serif;
    line-height: 1.6;
    color: #3a3a3a;
}

p {
    font-size: .95em;
    margin-bottom: 1.8em;
}

h2,
h3,
a {
    color: #093a58;
}

h2,
h3 {
    margin-top: 0;
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* ================================= 
  Base Layout Styles
==================================== */

/* ---- Navigation ---- */

.name {
    font-size: 1.25em;
}

.name a,
.main-nav a {
    text-align: center;

}

.main-nav a {
    font-size: .95em;
    color: #3acec2;
    text-transform: uppercase;

}


.main-nav a:hover {
    color: #093a58;
}

/* ---- Layout Containers ---- */

.banner {
    color: #fff;
    background: #3acec2;
  text-align: center;
  padding-top: 20px;
  padding-bottom: 20px;
}

.main-footer {
    background: #d9e4ea;
    padding: 2em 0;
    margin-top: 30px;
  text-align: center;
}

/* ---- Page Elements ---- */

.logo {
    width: 190px;
}


/* ================================= 
  Media Queries Larger Screen 3 column
==================================== */

@media (min-width: 769px) {

.main-header,
.main-nav,
.name {
  border: 3px solid red;
}

.main-nav {
    float: right;
}

.name a,
.main-nav a {
    padding: 10px 15px;
  display: inline-block;
}

.name,
.main-nav li {
  float: left;
  padding-left: 12px;

}

.container {
    width: 85%;
    max-width: 1150px;
    margin: 0 auto;
}

.col {
  float: left;
  padding-left:2em;
  padding-top: 20px;
}

.primary {
  width: 30%;
}

.secondary {
  width: 40%;
}

.tertiary {
  width: 30%;
}

    /* ---- Float clearfix ---- */

    .clearfix::after {
        content: " ";
        display: table;
        clear: both;
    }

}

9 Answers

Josh Cummings
Josh Cummings
16,310 Points

Try updating the version of normalize by replacing this:

<link rel="stylesheet" href="css/normalize.css">

With this:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css">

Also, fix the ul in the nav by adding this to your Base Layout Styles - Navigation section:

.main-nav {
  list-style-type: none;
  padding-left: 0;
}
Josh Cummings
Josh Cummings
16,310 Points

What browser are you on? Also, are you on a smaller screen? If so, it may be because there is not enough room and the "Best City Guide" h1 is pushing your ul down. They are vertically centered on the newest version of Chrome on my machine.

I'm using Chrome and it says it's up to date and my monitor is pretty large (31").

Thanks for trying - I'll just see take your word that it works for one person!

I need to review many things anyways.

Josh Cummings
Josh Cummings
16,310 Points

This is what I'm seeing on mine:

screenshot

Oh that's not what I see. I don't even see list item bullets.

How do you link an image? I don't have a website.

It's closer now... http://img4.imagetitan.com/img.php?image=13_screenshot2016-07-08at12.32.20pm.png

To me it looks like this in both Firefox and Chrome.

Josh Cummings
Josh Cummings
16,310 Points

Here's a snapshot of what I described. Seems to be working perfectly here. Scratching my head here. Obviously this doesn't include the images, but fire it up and see if it's doing the same thing.

https://w.trhou.se/0rtimoy5wu

Welcome to the wondeful world of cross-browser testing my friend! ;)

Josh Cummings
Josh Cummings
16,310 Points

You may want to click Fork Snapshot and view the page to see what I mean.

Oh wow...I wish mine looked like that! Interesting it came from the same code. Ugh!!!

Thanks for the welcome lol. This whole project is reminding me how seriously I need to take learning this. I learned a lot with your help regardless! Thanks!

Josh Cummings
Josh Cummings
16,310 Points

Any time! It's all part of the process. Keep going, it's worth it, I promise.