navigation mobile list not showing under each other because of logoo moving center of page

Viewed 15

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <style>


    .topnav {
        overflow: hidden;
        background-color: black;
    }

    .topnav a {
        float: left;
        display: block;
        color: #f2f2f2;
        text-align: center;
        padding: 14px 16px;
        text-decoration: none;
        font-size: 12px;
        }

    .topnav a:hover {
        background-color: #ddd;
        color: black;
        }

    .topnav a.active {
        background-color: #04AA6D;
        color: white;
        }

    .topnav .icon {
        display: none;
        }

    @media screen and (max-width: 600px) {
        .topnav a:not(:first-child) {display: none;}
        .topnav a.icon {
        float: right;
        display: block;
        }}
    @media screen and (max-width: 600px) {
        .topnav.responsive {position: center;}
        .topnav.responsive .icon {
        position: absolute;
        right: 0;
        top: 0;
        }
    .topnav.responsive a {
        float: none;
        display: block;
        text-align: center;
        }}
    body {
        margin: 0;
        font-family: raleway;
    }
</style>
</head>
<body>


<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- NAVIGATION -->
    <div class="topnav" id="myTopnav">
    <!-- logo --> 
        
    <!-- links -->
                <a href="#HOME" class="active">HOME</a>
        <a href="#OUR MISSION">OUR MISSION</a>
        <a href="#OUR SERVICES">OUR SERVICES</a>
        <a href="#BLOG">BLOG</a>
        <a href="#CONTACT US">CONTACT US</a>        
        
        <a href="javascript:void(0);" class="icon" onclick="myFunction()">
        <i class="fa fa-bars"></i>
        </a>
    </div>



</body>
    <script>
    function myFunction() {
      var x = document.getElementById("myTopnav");
      if (x.className === "topnav") {
        x.className += " responsive";
      } else {
        x.className = "topnav";
      }
    }
    </script>
</html>

The mobile navigation list is sort of centered, but it steps to the left under the logo. How can this be centered below the logo? Thanks in advance. I have been working on this for over a week now and have not got any closer. The 'flex' opton did not work on my google chrome. My skills are not that good as I am only learning.

Screenshot logo?

0 Answers
Related