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

aaron black
aaron black
3,469 Points

How do I change the size of my hamburger menu made in html and css only. I can change the width but not the height.

.main-header ul { margin-top: 3.5em; padding: 0; width: 100%; list-style: none; overflow: hidden; background: #151313; position: absolute; right: 0; text-align: center; font-size: 2.5em; font-family: }

.main-header li a { display: block; padding: 20px 20px; text-decoration: none; border-top: 1px solid #f3f3f2; }

.main-header li a:hover, .main-header .menu-btn:hover { color: #6cc5ae; }

/menu/ .main-header .menu { clear: both; max-height: 0; transition: max-height .2s ease-out; }

/menu icon/ .main-header .menu-icon { cursor: pointer; display: inline-block; flex: end; padding: 28px 20px; position: absolute; right: 12%; top: 30%; user-select: none; }

.main-header .menu-icon .navicon { background: #f3f3f2; display: block; height: 3px; position: relative; transition: background .2s ease-out; width: 3em;

}

.main-header .menu-icon .navicon:before, .main-header .menu-icon .navicon:after { background: #f3f3f2; content: ''; display: block; height: 100%; position: absolute; transition: all .2s ease-out; width: 100%; }

.main-header .menu-icon .navicon:before { top: 5px; font-size: 30px; }

.main-header .menu-icon .navicon:after { top: -5px; }

/menu btn/ .main-header .menu-btn { display: none; }

.main-header .menu-btn:checked ~ .menu { max-height: 550px;

}

.main-header .menu-btn:checked ~ .menu-icon .navicon { background: transparent; }

.main-header .menu-btn:checked ~ .menu-icon .navicon:before { transform: rotate(-45deg); } .main-header .menu-btn:checked ~ .menu-icon .navicon:after { transform: rotate(45deg); }

.main-header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:before, .main-header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:after { top: 0; }

Steven Parker
Steven Parker
229,744 Points

The HTML component seems to be missing. Also, 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.

2 Answers

aaron black
aaron black
3,469 Points

Thanks for that, I haven't posted much on here, hopefully this helps. This is my first site building from 'mobile first'. Thanks again for taking the time for this. hopefully when I get better at it I can contribute a little more too.

         <nav>
            <input class="menu-btn" type="checkbox" id="menu-btn" />
            <label class="menu-icon" for="menu-btn"><span class="navicon"></span></label>
            <ul class="menu">
                <li><a href="#">Home</a></li>
                <li><a href="/html/about.html">About</a></li>
                <li><a href="/html/boards.html">Boards</a></li>
                <li><a href="/html/surf-travel.html">Surf/Travel</a></li>
                <li><a href="/html/hieroglyphs.html">Hieroglyphs</a></li>
                <li><a href="/html/contact.html">Contact</a></li>
            </ul>

        </nav>
.main-header ul {
    margin-top: 3.5em;
    padding: 0;
    width: 100%;
    list-style: none;
    overflow: hidden;
    background: #151313;
    position: absolute;
    right: 0;
    text-align: center;
    font-size: 2.5em;
    font-family: 
}

.main-header li a {
    display: block;
    padding: 20px 20px;
    text-decoration: none;
    border-top: 1px solid #f3f3f2;
}

.main-header li a:hover,
.main-header .menu-btn:hover {
    color: #6cc5ae;
}

/*menu*/
.main-header .menu {
    clear: both;
    max-height: 0;
    transition: max-height .2s ease-out;
}

/*menu icon*/
.main-header .menu-icon {
    cursor: pointer;
    display: inline-block;
    flex: end;
    padding: 28px 20px;
    position: absolute;
    right: 12%;
    top: 30%;
    user-select: none;
}

.main-header .menu-icon .navicon {
    background: #f3f3f2;
    display: block;
    height: 3px;
    position: relative;
    transition: background .2s ease-out;
    width: 3em;

}


.main-header .menu-icon .navicon:before,
.main-header .menu-icon .navicon:after {
    background: #f3f3f2;
    content: '';
    display: block;
    height: 100%;
    position: absolute;
    transition: all .2s ease-out;
    width: 100%;
}

.main-header .menu-icon .navicon:before {
    top: 5px;
    font-size: 30px;
}

.main-header .menu-icon .navicon:after {
    top: -5px;
}

/*menu btn*/
.main-header .menu-btn {
    display: none;
}

.main-header .menu-btn:checked ~ .menu {
    max-height: 550px;

}

.main-header .menu-btn:checked ~ .menu-icon .navicon {
    background: transparent;
}

.main-header .menu-btn:checked ~ .menu-icon .navicon:before {
    transform: rotate(-45deg);
}
.main-header .menu-btn:checked ~ .menu-icon .navicon:after {
    transform: rotate(45deg);
}

.main-header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:before,
.main-header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:after {
    top: 0;
}
aaron black
aaron black
3,469 Points

I just figured it out as I was reading over the code on my answer. this is the change I made. Thanks again for your help!

.main-header .menu-icon .navicon:before {
    top: 15px;
    font-size: 30px;
}

.main-header .menu-icon .navicon:after {
    top: -15px;
}