RicPurcell
RicPurcell

Reputation: 86

Css Menu Browser Issue

/* Main Nav */
  /* Positioning */
#banner nav {
	margin-top: 14.2em;
	margin-bottom: 0;;
	margin-left: 0;
}
 
#cssmenu,
#cssmenu ul,
#cssmenu li,
#cssmenu a {
  border: none;
  line-height: 1;
  margin: 0 ;
  padding: 0;
}

#cssmenu {
  margin:auto;
  border-top:1px solid #000;
  height: 37px;
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
}

#cssmenu > ul {
  list-style: inside none;
  margin: auto;
  padding: 0;
}

#cssmenu > ul > li {
  list-style: inside none;
  float: left;
  display: inline-block;
  position: relative;
  margin: 0;
  padding: 0;
}

#cssmenu.align-center > ul {
  text-align: center;
}

#cssmenu.align-center > ul > li {
  float: none;
}

#cssmenu.align-center ul ul {
  text-align: left;
}

#cssmenu > ul > li > a {
  outline: none;
  display: block;
  position: relative;
  text-align: center;
  text-decoration: none;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
  font-weight: 700;
  font-size: 13px;
  font-family: Arial, Helvetica, sans-serif;
  border-color:transparent;
  border-left:1px solid #000;
  border-bottom:1px solid #000;
  border-right:1px solid #000;
  margin-bottom:4px;
  color: #FFFFFF;
  padding: 12px 34px;
  border-bottom-left-radius:10px;
  border-bottom-right-radius:10px;
  -moz-outline-radius-bottomleft:10px;
  -moz-border-radius-bottomright:10px;
  -webkit-border-bottom-left-radius:10px;
  -webkit-border-bottom-right-radius:10px;
  background: -moz-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #007df8), color-stop(100%, #07275d));
  background: -webkit-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -o-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -ms-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: linear-gradient(top, #007df8 0%, #07275d 100%);
}

#cssmenu > ul > li.last > a{
	width:64px;
}

#cssmenu > ul > li > a:after {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  right: -2px;
  z-index: 102;
  border-color: #000000;
}

#cssmenu > ul > li.last > a:after {
  border-right:none
}

#cssmenu ul li.has-sub:hover > a:after {
  top: 0;
  bottom: 0;
}

#cssmenu > ul > li.has-sub > a:before {
  content: "";
  position: absolute;
  top: 18px;
  right: 10px;
  border: 5px solid transparent;
  border-top: 5px solid #000;
}

#cssmenu > ul > li.has-sub:hover > a:before {
  top: 19px;
}

#cssmenu > ul > li.has-sub:hover > a {
  padding-bottom: 12px;
  z-index: 999;
  border-color: transparent;
  background:#07275d;
  
}

#cssmenu ul li.has-sub:hover > ul,
#cssmenu ul li.has-sub:hover > div {
  display: block;
}

#cssmenu > ul > li.has-sub > a:hover
#cssmenu > ul > li.has-sub:hover > a {
  border-color: #000;
}

#cssmenu ul li > ul,
#cssmenu ul li > div {
  display: none;
  width: auto;
  position: absolute;
  top: 40px;
  background: #07275d;
  z-index: 999;
  padding: 10px 0;
  border-bottom-left-radius:10px;
  border-bottom-right-radius:10px;
  -moz-outline-radius-bottomleft:10px;
  -moz-border-radius-bottomright:10px;
  -webkit-border-bottom-left-radius:10px;
  -webkit-border-bottom-right-radius:10px;
}

#cssmenu ul li > ul {
  width: 200px;
}

#cssmenu ul ul ul {
  position: absolute;
}

#cssmenu ul ul li:hover > ul {
  left: 100%;
  top: -10px;
}

#cssmenu ul li > ul li {
  display: block;
  list-style: inside none;
  position: relative;
  margin: 0;
  padding: 0;
}

#cssmenu ul li > ul li a {
  outline: none;
  display: block;
  position: relative;
  font: 10pt Arial, Helvetica, sans-serif;
  color: #FFFFFF;
  text-decoration: none;
  text-align:center;
  margin: 0;
  padding: 8px 0px;
  border-radius:10px;
  -moz-border-radius:10px;
  -webkit-border-radius:10px;
}

#cssmenu ul ul li a:hover {
  background: -moz-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #007df8), color-stop(100%, #07275d));
  background: -webkit-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -o-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -ms-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: linear-gradient(top, #007df8 0%, #07275d 100%);
}

#cssmenu > ul > li > a:hover {
  background: #07275d;
  color: #FFFFFF;
}

#cssmenu > ul > li.has-sub > a:hover:before {
  border-top: 5px solid #FFFFFF;
}

/* Featured */
#featured {
	margin-top:0.3em;
	margin-bottom: 2em;background: -moz-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #007df8), color-stop(100%, #07275d));
  background: -webkit-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -o-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: -ms-linear-gradient(top, #007df8 0%, #07275d 100%);
  background: linear-gradient(top, #007df8 0%, #07275d 100%);
	overflow: hidden;
	padding: 20px;
	padding-bottom:0;
	width: 760px;
	border-radius: 10px;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
}

Hi I have made a css menu which works perfectly how I want it too but I have just noticed after testing it in Microsoft Edge & Mozilla Firefox that in Microsoft Edge on the right side there is a slight gap and cannot find why can anybody help me please a Live Preview here also attached it my css code for the menu

thanks in advance

Upvotes: 0

Views: 75

Answers (3)

sarfaraj
sarfaraj

Reputation: 158

Please try below code, i have create cssmenu. it's very helpful to you.

HTML Code

 <div>
        <ul class="cssmenu">
            <li><a href="#">link 01</a></li>
            <li><a href="#">link 02</a></li>
            <li><a href="#">link 03</a></li>
            <li><a href="#">link 04</a></li>
            <li><a href="#">link 05</a></li>
        </ul>
    </div>

CSS Code

.cssmenu{
    padding:0;
    margin:0;
    display:inherit;
}

.cssmenu li{
    -webkit-flex:1;
    display:inherit;
    text-align:center;
    line-height:50px;
    background:#07275d;
    color:#ffffff;
    border:1px solid #000;
    -webkit-border-radius: 0 0 8px 8px;
    border-radius: 0 0 8px 8px;
}
.cssmenu li a{color:#fff; text-decoration:none}

@media (min-width: 767px){
    .cssmenu{display:flex;}
    .cssmenu li{display:inline-block;}

}

Upvotes: 0

sarfaraj
sarfaraj

Reputation: 158

Please use this code and apply for your color style in this css

#cssmenu,
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul li a,
#cssmenu #menu-button {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
  line-height: 1;
  display: block;
  position: relative;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
#cssmenu:after,
#cssmenu > ul:after {
  content: ".";
  display: block;
  clear: both;
  visibility: hidden;
  line-height: 0;
  height: 0;
}
#cssmenu #menu-button {
  display: none;
}
#cssmenu {
  font-family: Montserrat, sans-serif;
  background: #333333;
}
#cssmenu > ul > li {
  float: left;
}
#cssmenu.align-center > ul {
  font-size: 0;
  text-align: center;
}
#cssmenu.align-center > ul > li {
  display: inline-block;
  float: none;
}
#cssmenu.align-center ul ul {
  text-align: left;
}
#cssmenu.align-right > ul > li {
  float: right;
}
#cssmenu > ul > li > a {
  padding: 17px;
  font-size: 12px;
  letter-spacing: 1px;
  text-decoration: none;
  color: #dddddd;
  font-weight: 700;
  text-transform: uppercase;
}
#cssmenu > ul > li:hover > a {
  color: #ffffff;
}
#cssmenu > ul > li.has-sub > a {
  padding-right: 30px;
}
#cssmenu > ul > li.has-sub > a:after {
  position: absolute;
  top: 22px;
  right: 11px;
  width: 8px;
  height: 2px;
  display: block;
  background: #dddddd;
  content: '';
}
#cssmenu > ul > li.has-sub > a:before {
  position: absolute;
  top: 19px;
  right: 14px;
  display: block;
  width: 2px;
  height: 8px;
  background: #dddddd;
  content: '';
  -webkit-transition: all .25s ease;
  -moz-transition: all .25s ease;
  -ms-transition: all .25s ease;
  -o-transition: all .25s ease;
  transition: all .25s ease;
}
#cssmenu > ul > li.has-sub:hover > a:before {
  top: 23px;
  height: 0;
}
#cssmenu ul ul {
  position: absolute;
  left: -9999px;
}
#cssmenu.align-right ul ul {
  text-align: right;
}
#cssmenu ul ul li {
  height: 0;
  -webkit-transition: all .25s ease;
  -moz-transition: all .25s ease;
  -ms-transition: all .25s ease;
  -o-transition: all .25s ease;
  transition: all .25s ease;
}
#cssmenu li:hover > ul {
  left: auto;
}
#cssmenu.align-right li:hover > ul {
  left: auto;
  right: 0;
}
#cssmenu li:hover > ul > li {
  height: 35px;
}
#cssmenu ul ul ul {
  margin-left: 100%;
  top: 0;
}
#cssmenu.align-right ul ul ul {
  margin-left: 0;
  margin-right: 100%;
}
#cssmenu ul ul li a {
  border-bottom: 1px solid rgba(150, 150, 150, 0.15);
  padding: 11px 15px;
  width: 170px;
  font-size: 12px;
  text-decoration: none;
  color: #dddddd;
  font-weight: 400;
  background: #333333;
}
#cssmenu ul ul li:last-child > a,
#cssmenu ul ul li.last-item > a {
  border-bottom: 0;
}
#cssmenu ul ul li:hover > a,
#cssmenu ul ul li a:hover {
  color: #ffffff;
}
#cssmenu ul ul li.has-sub > a:after {
  position: absolute;
  top: 16px;
  right: 11px;
  width: 8px;
  height: 2px;
  display: block;
  background: #dddddd;
  content: '';
}
#cssmenu.align-right ul ul li.has-sub > a:after {
  right: auto;
  left: 11px;
}
#cssmenu ul ul li.has-sub > a:before {
  position: absolute;
  top: 13px;
  right: 14px;
  display: block;
  width: 2px;
  height: 8px;
  background: #dddddd;
  content: '';
  -webkit-transition: all .25s ease;
  -moz-transition: all .25s ease;
  -ms-transition: all .25s ease;
  -o-transition: all .25s ease;
  transition: all .25s ease;
}
#cssmenu.align-right ul ul li.has-sub > a:before {
  right: auto;
  left: 14px;
}
#cssmenu ul ul > li.has-sub:hover > a:before {
  top: 17px;
  height: 0;
}
#cssmenu.small-screen {
  width: 100%;
}
#cssmenu.small-screen ul {
  width: 100%;
  display: none;
}
#cssmenu.small-screen.align-center > ul {
  text-align: left;
}
#cssmenu.small-screen ul li {
  width: 100%;
  border-top: 1px solid rgba(120, 120, 120, 0.2);
}
#cssmenu.small-screen ul ul li,
#cssmenu.small-screen li:hover > ul > li {
  height: auto;
}
#cssmenu.small-screen ul li a,
#cssmenu.small-screen ul ul li a {
  width: 100%;
  border-bottom: 0;
}
#cssmenu.small-screen > ul > li {
  float: none;
}
#cssmenu.small-screen ul ul li a {
  padding-left: 25px;
}
#cssmenu.small-screen ul ul ul li a {
  padding-left: 35px;
}
#cssmenu.small-screen ul ul li a {
  color: #dddddd;
  background: none;
}
#cssmenu.small-screen ul ul li:hover > a,
#cssmenu.small-screen ul ul li.active > a {
  color: #ffffff;
}
#cssmenu.small-screen ul ul,
#cssmenu.small-screen ul ul ul,
#cssmenu.small-screen.align-right ul ul {
  position: relative;
  left: 0;
  width: 100%;
  margin: 0;
  text-align: left;
}
#cssmenu.small-screen > ul > li.has-sub > a:after,
#cssmenu.small-screen > ul > li.has-sub > a:before,
#cssmenu.small-screen ul ul > li.has-sub > a:after,
#cssmenu.small-screen ul ul > li.has-sub > a:before {
  display: none;
}
#cssmenu.small-screen #menu-button {
  display: block;
  padding: 17px;
  color: #dddddd;
  cursor: pointer;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}
#cssmenu.small-screen #menu-button:after {
  position: absolute;
  top: 22px;
  right: 17px;
  display: block;
  height: 4px;
  width: 20px;
  border-top: 2px solid #dddddd;
  border-bottom: 2px solid #dddddd;
  content: '';
}
#cssmenu.small-screen #menu-button:before {
  position: absolute;
  top: 16px;
  right: 17px;
  display: block;
  height: 2px;
  width: 20px;
  background: #dddddd;
  content: '';
}
#cssmenu.small-screen #menu-button.menu-opened:after {
  top: 23px;
  border: 0;
  height: 2px;
  width: 15px;
  background: #ffffff;
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
}
#cssmenu.small-screen #menu-button.menu-opened:before {
  top: 23px;
  background: #ffffff;
  width: 15px;
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
#cssmenu.small-screen .submenu-button {
  position: absolute;
  z-index: 99;
  right: 0;
  top: 0;
  display: block;
  border-left: 1px solid rgba(120, 120, 120, 0.2);
  height: 46px;
  width: 46px;
  cursor: pointer;
}
#cssmenu.small-screen .submenu-button.submenu-opened {
  background: #262626;
}
#cssmenu.small-screen ul ul .submenu-button {
  height: 34px;
  width: 34px;
}
#cssmenu.small-screen .submenu-button:after {
  position: absolute;
  top: 22px;
  right: 19px;
  width: 8px;
  height: 2px;
  display: block;
  background: #dddddd;
  content: '';
}
#cssmenu.small-screen ul ul .submenu-button:after {
  top: 15px;
  right: 13px;
}
#cssmenu.small-screen .submenu-button.submenu-opened:after {
  background: #ffffff;
}
#cssmenu.small-screen .submenu-button:before {
  position: absolute;
  top: 19px;
  right: 22px;
  display: block;
  width: 2px;
  height: 8px;
  background: #dddddd;
  content: '';
}
#cssmenu.small-screen ul ul .submenu-button:before {
  top: 12px;
  right: 16px;
}
#cssmenu.small-screen .submenu-button.submenu-opened:before {
  display: none;
}
#cssmenu.small-screen.select-list {
  padding: 5px;
}

Upvotes: 1

haveapk
haveapk

Reputation: 16

A better way to do this would be to use flexbox to make sure your menu can fill the width of your page.

The Flexbox Layout (Flexible Box) module (currently a W3C Last Call Working Draft) aims at providing a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic (thus the word "flex").

For a good reference on flexbox see: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

And for my CSS that fixes this see: http://jsfiddle.net/haveapk/berthtsv/

I first set the containing ul display mode as flex (see code below)

display:-webkit-flex;
display:flex;

Then gave the children elements these styles so they would all be an equal size

-webkit-flex:1;
flex:1;

If you wanted one item to be bigger then the others you can change its flex style.

Upvotes: 0

Related Questions