Navigation Menu Shrinks with Browser Sizing - CSS Issue

223 views Asked by At

I created a navigation menu for a re-design of a website that's a Printing Company. Everything is working perfectly, but I can't find out why the Navigation shrinks when you change the browser size. I've created these menus before, and I've never had a problem with shrinking.

Here is the Demo https://jsfiddle.net/dshojaei/vbcztkdy/3/embedded/result/

  #nav_wrap {
    text-align: center;
    background-color:#343232;
    border-top:1px solid black;
    height:54px;
}

/* Reset */
.nav,
.nav a,
.nav ul,
.nav li,
.nav div,
.nav form,
.nav input {
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
}

.nav a { text-decoration: none; }

.nav li { list-style: none; }

/* Menu Container */
.nav {
    display: inline-block;
    position: relative;
    cursor: default;
    z-index: 500;
    text-align:left;

}

/* Menu List */
.nav > li {
    display:block;
    float: left;
}

/* Menu Links */
.nav > li > a {
    position: relative;
    display: block;
    z-index: 510;
    height: 54px;
    padding: 0 20px;
    line-height: 54px;

    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
    font-size: 13px;
    color: #fcfcfc;
    text-shadow: 0 0 1px rgba(0,0,0,.35);

    background: #343232;
    border-left:none;
    border-right:none;

    -webkit-transition: all .3s ease;
    -moz-transition: all .3s ease;
    -o-transition: all .3s ease;
    -ms-transition: all .3s ease;
    transition: all .3s ease;
}
.businesscards:hover > a { 
    background:#009ad6; 
}
.flyers:hover > a{
    background:#c60077; 
}
.cards:hover > a {
    background:#cec41e;
}
.banner:hover > a {
    background:#000000; 
}
.dvd:hover > a {
    background:#3c3c3c; 
}
.stationary:hover > a {
    background:#7b7b7b; 
}
.labels:hover > a {
    background:#afafaf; 
}
.catalogs:hover > a {
    background:#d7d7d7; 
}
.nav > li:first-child > a {
    border-radius: 0px 0 0 0px;
    border-left: none;
}


/* Menu Dropdown */
.nav > li > div {
    position: absolute;
    display: block;
    width: 100%;
    top: 55px;
    left: 0;

    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    border-right:1px solid black;
    border-left:1px solid black;
    border-bottom:1px solid black;
    background: #ffffff;
    border-radius: 0 0 3px 3px;
    -webkit-transition: all .3s ease .15s;
    -moz-transition: all .3s ease .15s;
    -o-transition: all .3s ease .15s;
    -ms-transition: all .3s ease .15s;
    transition: all .3s ease .15s;
}

.nav > li:hover > div {
    opacity: 1;
    visibility: visible;
    overflow: visible;
}

/* Menu Content Styles */
.nav .nav-column {
    float: left;
    width: 20%;
    padding: 2.5%;
}

.nav .nav-column h3 {
    margin: 20px 0 10px 0;
    line-height: 18px;
    display:inline;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
    font-size: 14px;
    color: #372f2b;
    text-transform: uppercase;
}
/*.nav .nav-column img {
    display:inline; 
    width:20%;
    height: 20%;
}
*/
.nav img:nth-of-type(1) {
    margin-top:30px;
    margin-left:20px;
    float:left;
    width:5%;
    height:5%;
}
.nav img:nth-of-type(2) {
    margin-top:30px;
    margin-left:20px;
    float:left;
    width:5%;
    height:5%;
}
#brochure {
    margin-top:30px;
    margin-left:20px;
    float:left;
    width:3%;
    height:3%   
}

.nav .nav-column h3.orange { color: #ff722b; }

.nav .nav-column li a {
    display: block;
    line-height: 26px;

    font-family: Helvetica, Arial, sans-serif;
    font-weight: bold;
    font-size: 13px;
    color: #888888;
}

.nav .nav-column li a:hover { color: #666666; }
2

There are 2 answers

0
Mr_vasu On BEST ANSWER

fix the width.

    .nav {
          display: inline-block;
          position: relative;
          cursor: default;
          z-index: 500;
          text-align: left;
          width: 1190px;
    }
    

1
DRD On

You can change the code for the list items to the following:

.nav > li {
    display: inline-block;
}

And, add the following declaration to the list rule set:

.nav {
    display: inline-block;
    position: relative;
    cursor: default;
    z-index: 500;
    text-align:left;
    white-space: nowrap;
}

In order, for this to display properly, the list items, in HTML, should be next to each other, otherwise you'll see spaces:

<ul><li></li><li></li></ul>