Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Layout Techniques Flexbox Layout Flexbox Columns

.extra-content col are missed

For some reason browser doesn't show .extra-content col.

<!DOCTYPE html> <html> <head> <title>Flexbox Layout</title> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="main-wrapper"> <header class="main-header"> <ul class="main-nav"> <li class="main-logo"><h1><a href="#">Logo</a></h1></li> <li><a href="#" data-icon="&#xe602;">Home</a></li> <li><a href="#" data-icon="&#xe601;">About</a></li> <li><a href="#" data-icon="&#xe603;">Blog</a></li> <li><a href="#" data-icon="&#xe600;">Contact</a></li> </ul> </header> <div class="main-banner"> <h1>This is the Main Banner Heading</h1> <p>Andouille pork chop pancetta drumstick ground round beef ribs swine brisket ham.</p> </div> <div class="content-row"> <div class="extra-content col"> <h3>Extra Content</h3> <p>Filet mignon turkey flank doner strip steak. Frankfurter ham hock turkey, venison sirloin pig chuck shank capicola hamburger doner spare ribs boudin.</p> <hr> <p> Drumstick bresaola meatloaf ham hock salami tri-tip landjaeger beef filet mignon biltong boudin turkey.</p> </div> <div class="primary-content col"> <h2>Primary Content</h2> <img class="feat-img" src="http://lorempixel.com/400/300" /> <p>Bacon ipsum dolor sit amet chicken pork ground round brisket corned beef ball tip shank tail salami filet mignon ham hock pork belly venison shankle. Pig kielbasa drumstick sausage pork chop boudin. Chicken t-bone salami pork chop, beef ribs kevin ham tri-tip beef venison biltong brisket.</p> <p>Venison strip steak meatball chicken, brisket prosciutto sirloin. Capicola drumstick brisket tri-tip salami. Chicken beef jerky, tail turkey prosciutto cow ham sirloin boudin tenderloin. Meatloaf tri-tip turducken brisket andouille, pork belly corned beef fatback hamburger.</p> </div> <div class="secondary-content col"> <h3>Secondary Content</h3> <p>Strip steak tenderloin kevin swine meatloaf capicola, doner beef turducken pancetta corned beef pork loin shoulder.</p> <hr> <p>Pork filet mignon leberkas, tail swine venison pancetta turkey shoulder brisket chalkers likes hamburgers.</p> </div> </div> <footer class="main-footer"> <p>©2014 Example Layout</p> </footer> </div> </body> </html>

that's only when I apply style.css

/* Page Styles
================================ */

* {
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
body {
    font: normal 1.1em/1.5 sans-serif;
    color: #222;
    background-color: #edeff0;
}

/* Icon Fonts
================================ */

@font-face {
    font-family: 'icomoon';
    src:url('../fonts/icomoon.eot');
    src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
        url('../fonts/icomoon.woff') format('woff'),
        url('../fonts/icomoon.ttf') format('truetype'),
        url('../fonts/icomoon.svg#icomoon') format('svg');
    font-weight: normal;
    font-style: normal;
}

/* Layout Element Colors
================================ */

.main-header       { background-color: #384047; }
.main-nav a        { background-color: #3f8abf; }
.main-logo a       { background-color: #5fcf80; }
.primary-content   { background-color: #caebf6; }
.main-footer       { background-color: #b7c0c7; }

/* Main Layout
================================ */

.main-header,
.col {
    padding: 20px;
}
.main-logo a, 
.main-nav a {
    display: block;
    color: white;
    text-decoration: none;
    text-align: center;
    padding: 8px 15px;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}
.main-nav a::before {
    font-family: 'icomoon';
    content: attr(data-icon);
    color: #fff;
    position: absolute;
    top: 10px;
    left: -30%;
    transition: .4s;
}
.main-nav a:hover::before {
    left: 10%;

}
.main-footer {
    text-align: center;
    padding-top: 5px;
    padding-bottom: 5px;
}
.extra-content,
.main-banner {
    display: none;
}


/* Imagery
================================ */

.feat-img {
    width: 100%;
    margin-top: 10px;
    margin-bottom: 10px;
    border: solid 1px;
    padding: 5px;
}

/* Media Queries
================================ */

@media (min-width: 1px) and (max-width: 768px) {
    .main-nav li {
        margin-top: 15px;
    }
    .main-nav li:first-child {
        margin-top: 0;
    }
}

@media (min-width: 769px) {

    body {
        padding-top: 120px;
    }

    /* Header and Banner Layout
    ================================ */

    .main-header {
        position: fixed;
        top: 0;
        width: 100%;
        height: 120px;
    }
    .main-nav {
        display: -webkit-flex;
        display: flex;
        height: 100%;
    }
    .main-nav li {
        margin-left: 8px;
        margin-right: 8px;
        -webkit-align-self: center;
        align-self: center;
        -webkit-flex-grow: 1;
        flex-grow: 1;
        transition: .5s;
    }
    .main-nav li:hover:not(.main-logo) {
        -webkit-flex-grow: 2;
        flex-grow: 2;
    }
    .main-logo:first-child {
        margin-right: 50px;
    }
    .main-banner {
        background: #dfe2e4;
        text-align: center;
        padding: 50px 15px;
        display: block;
    }

    /* Column Layout
    ================================ */
    .content-row{
        display: flex;
    }

    /* Imagery
    ================================ */

    .feat-img {
        width: 50%;
        float: left;
        margin-right: 25px;
    }
}

3 Answers

Andrew Gross
Andrew Gross
5,333 Points

The layout of your questions is a little jumbled but from what I can see this line in your style.css is why you wouldn't see that .extra-content, .main-banner { display: none; } you would need to set the display appropriately in one of your media queries

I just find in css in main part, the next thing .extra-content, .main-banner { display: none; }

in media query we define .main-banner so it shows to me, but .extra-content not so it s missed. what I need to do?

Andrew Gross
Andrew Gross
5,333 Points
.extra-content {
  display:block;
}

would need to be placed in the media query if you want it displayed as block on that screen size