Brandon Powell Brandon Powell - 1 year ago 74
Sass (Sass) Question

Dropdown position Issue

I'm working on navbar dropdown menu and him having some trouble trying to position the dropdown menu with a width 100% but when every I put width to 100% it expands to right but not the left side.

Here the link to a preview of my project working on. Hope someone by can help with the small quick problem having.

Preview Link -->

This is what trying to accomplish


<nav class="navbar-default primary-nav navbar-fixed-top nav-down">
<div class="container-fluid">
<div class="row">
<div class="top-navbar">
<div class="media-icons">
<a href="#"><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a>
<a href="#"><i class="fa fa-twitter-square" aria-hidden="true"></i></a>

<a href="#"><div class="donate-button">

<div class="bottom-navbar">
<div class="logo">Logo Here</div>
<div class="nav-menu"><img src="icons/menu.svg"></div>
<ul class="navbar">
<li><a href="#">Home</a></li>
<li><a href="#">Founder's Message</a></li>
<li><a href="#" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true" aria-expanded="false">About Us</a>
<ul class="nav-content">
<li><a href="#">dropdown item 1</a></li>
<li><a href="#">dropdown item 2</a></li>
<li><a href="#">dropdown item 3</a></li>
<li><a href="#">dropdown item 4</a></li>
<li><a href="#">dropdown item 5</a></li>
<li><a href="#">dropdown item 6</a></li>
<li><a href="#">Join Our Team</a></li>
<li><a href="#">News & Events</a></li>
<li><a href="#">Campus Clubs</a></li>
<li><a href="#">Resources</a></li>
<li><a href="#">Contact Us</a></li>


body, html {
margin: 0px;
padding: 0px;
box-sizing: border-box; }

nav .top-navbar {
background-color: #212121;
position: absolute;
height: 67px;
width: 100%; }

.donate-button {
position: relative;
float: right;
top: 0px;
z-index: 1; }
.donate-button p {
font-style: Montserrat, sans-serif;
background-color: #961de7;
letter-spacing: 1px;
padding: 21.4px 35px;
margin-bottom: 0px;
font-weight: bold;
text-transform: uppercase;
color: white; }

.bottom-navbar {
background-color: white;
width: 100%;
display: inline-block;
-webkit-box-shadow: 0px 10px 0px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 10px 0px rgba(0, 0, 0, 0.2);
box-shadow: 0px 10px 0px rgba(0, 0, 0, 0.2); }

.nav-menu {
display: none; }

.navbar {
display: table; }
.navbar a:hover {
color: pink; }
.navbar li {
display: table-cell;
list-style-type: none;
padding: 0;
margin: 0;
font-size: 14px;
letter-spacing: 0.5px;
font-weight: bold;
text-transform: uppercase; }
.navbar li a {
text-decoration: none;
color: #212121; }

.nav-content {
position: absolute;
top: 13.3em;
z-index: -1;
padding: 1.3em 0 !important;
overflow: hidden;
width: 100%;
background-color: #a656dc; }
.nav-content a {
color: white;
text-decoration: none; }

.logo {
background-color: #961de7;
color: white;
font-size: 16pt;
float: left;
padding: 39px 6%; }

Answer Source

you need to add a value for 'left' to the nav-content div like this:

   .nav-content {
        position: absolute;
        top: 13.3em;
        z-index: -1;
        padding: 1.3em 0 !important;
        overflow: hidden;
        width: 100%;
        background-color: #a656dc;
        left: 0; /*add this*/

and to center the menu add margin:auto to the ul element like this:

    .nav-content ul {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download