2

How can I move "Sign up" to the bottom of the nav bar.

It looks like mobilemenu margin is taking priority. I am not 100% sure how to fix this

I have tried multiple things such as symbols like this > and +. Additionally, I tried moving the margin edits to each class "main" and "account" but the mobilemenu is the navbar itself.

What I need fixed

HTML:

<style>
    <%@include file="../css/header/header.css" %>
</style>
<!-- Mobile Navigation -->
<script>var checkbox = document.querySelector('#myInput');
var icon = document.querySelector('#menuToggle span');
var listener = function (e) {
    if (e.target != checkbox && e.target != icon) {
        checkbox.checked = false;
        document.removeEventListener('click', listener);
    }
};

checkbox.addEventListener('click', function () {
    if (this.checked) {
        document.addEventListener('click', listener);
    }
});
</script>
<header>
    <nav role="navigation">
        <div id="menuToggle">
            <input type="checkbox" id="myInput"/>
            <span></span>
            <span></span>
            <span></span>
            <ul class="mobilemenu">
                <li><a href="#about" class="main">About Me</a></li>
                <li><a href="#experience" class="main">Experience</a></li>
                <li><a href="#projects" class="main">Projects</a></li>
                <li><a href="#about" class="main">About Me</a></li>
                <li><a href="#experience" class="main">Experience</a></li>
                <li><a href="#projects" class="main">Projects</a></li>
                <li><a href="#projects" class="account">Sign Up</a></li>
            </ul>
        </div>
    </nav>
</header>

CSS:

/* Mobile Menu */
body {
    background: #1F2833;
    font-family: 'Source Sans Pro', sans-serif;
    color: #66FCF1;
}

#menuToggle {
    display: block;
    position: relative;
    top: 20px;
    left: 20px;
    z-index: 1;
    -webkit-user-select: none;
    user-select: none;
    padding: 6px 4px 1.5px 4px;
}

#menuToggle a {
    text-decoration: none;
    transition: color 0.3s ease;
}

#menuToggle a:hover {
    color: #45A29E;
}

#menuToggle input {
    display: block;
    width: 40px;
    height: 32px;
    position: absolute;
    top: -7px;
    left: -5px;
    cursor: pointer;
    opacity: 0; /* hide this */
    z-index: 2; /* and place it over the hamburger */
    -webkit-touch-callout: none;
}

#menuToggle span {
    display: block;
    width: 33px;
    height: 4px;
    margin-bottom: 5px;
    position: relative;
    background: #0b0C10;
    border-radius: 1px;
    z-index: 1;
    transform-origin: 4px 0px;
    transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1),
    background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1), opacity 0.55s ease;
}

#menuToggle span:first-child {
    transform-origin: 0% 0%;

}

#menuToggle span:nth-last-child(2) {
    transform-origin: 0% 100%;
}

#menuToggle input:checked ~ span {
    opacity: 1;
    transform: rotate(45deg) translate(-2px, -1px);
    background: #66FCF1;
}

#menuToggle input:checked ~ span:nth-last-child(3) {
    opacity: 0;
    transform: rotate(0deg) scale(0.2, 0.2);
}

#menuToggle input:checked ~ span:nth-last-child(2) {
    transform: rotate(-45deg) translate(0, -1px);
}



.mobilemenu {
    width: 8.7rem;
    height: 100%;
    margin: -80px -20px 0 -35px;
    padding: 25px;
    padding-top: 75px;
    padding-bottom: 20px;
    background: #0b0C10;
    list-style-type: none;
    -webkit-font-smoothing: antialiased;
    transform-origin: 0% 0%;
    transform: translate(-100%, 0);
    transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
    position: fixed;
    vertical-align: middle;
}

.mobilemenu li {
    padding: 10px 0;
    padding-left: 20px;
    font-size: 22px;
}

.mobilemenu .main{
    color: #66FCF1;
}

#menuToggle .account{
    color: #66FCF1;
    padding-top: 200px;
}

#menuToggle input:checked ~ ul {
    transform: none;
}
Rahman Haroon
  • 1,088
  • 2
  • 12
  • 36
Donobuz
  • 61
  • 10

3 Answers3

2

use span tag like:

<li> <span class="myaccount"> <a href="#projects" >Sign Up</a></span> </li>

or P tag:

<li> <p class="myaccount"><a href="#projects" >Sign Up</a></p></li>

change this

    
    
#menuToggle .account{
    color: #66FCF1;
    padding-top: 200px;
}

TO:

    
.myaccount{
    color: #66FCF1;
    padding-top: 60px;
}

you can edit padding or margin.

mehedi
  • 106
  • 6
  • this worked well! but my css had a span tag edit that made everything out of place. This definitely would have worked if I didn't have the span tag. The p tag I believe has an innate line break. That didnt work either. – Donobuz Dec 31 '20 at 07:36
  • you could edit p tag with inline style
  • – mehedi Dec 31 '20 at 09:01