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

Irfan Hussain
PLUS
Irfan Hussain
Courses Plus Student 6,593 Points

Why my banner logo overlap with header...

<!DOCTYPE HTML> <html lang="en-US"> <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="normalize.css" /> <link rel="stylesheet" href="style.css" /> </head> <body> <header class="main-header"> <div class="container clearfix"> <h1 class="name"><a href="#"> Best City Guide </a> </h1>

<ul class="main-nav">
    <li><a href="#">ICE CREAM</a></li>
    <li><a href="#">DONUT</a></li>
    <li><a href="#">TEA</a></li>
    <li><a href="#">COFFEE</a></li>
</ul>

</div>
</header>

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

<div class="container clearfix">

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

</body> </html>

  • { box-sizing: border-box; }

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

a { text-decoration: none; }

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

img { max-width: 100%; }

/***************************************** Main Header *****************************************/

.main-header { padding-top: .5em; padding-bottom: .5em; }

.name { font-size: 1.25em; margin: 0; }

.name a, .main-nav a{ display: block; text-align: center; padding: 10px 15px;

}

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

/***************************************** Banner *****************************************/ .banner { text-align: center; }

.banner { color: #fff; background: #3acec2; padding: 3.2em 0; margin-bottom: 60px;

} .logo { width: 190px; } .headline { margin-bottom: 0; } /***************************************** Responsive Layout *****************************************/

@media (min-width: 750px) {

.main-header {
    position: fixed;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.4);
    width: 100%;
    top: 0;
    z-index: 1000;
}

.container {
 width: 90%;
 margin: 0 auto;

}

.name {
    float: left;
}

.main-nav {
    float: right;
}

.main-nav li{
    display: inline-block;
    margin-left: 15px;
}


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

}

Steven Parker
Steven Parker
229,967 Points

When posting code, use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down: ย  Or watch this video on code formatting.

1 Answer

Laura Reivinen
Laura Reivinen
12,520 Points

Hi there! I think your problem might be that since your header has position:fixed, the banner is positioned at the top of the page. The problem is solved if you add margin-top that equals the height of your header to banner class.