I managed to create a menu with drop-down-menu (sub menu) using CSS. But I can't able to add smooth drop down-menu effect to my coding. I tried to add -moz-transition and more. I didn't know where to add those transition to make my normal drop-down-menu as smooth drop down-menu effect.
Below is my HTML coding
<div id='cssmenu'>
<ul>
<li class='active'><a href='index.html'><span>Home</span></a></li>
<li class='has-sub'><a href='#'><span>Products</span></a>
<ul>
<li class='has-sub'><a href='#'><span>Product 1</span></a>
<ul>
<li><a href='#'><span>Sub Item</span></a></li>
<li class='last'><a href='#'><span>Sub Item</span></a></li>
</ul>
</li>
<li class='has-sub'><a href='#'><span>Product 2</span></a>
<ul>
<li><a href='#'><span>Sub Item</span></a></li>
<li class='last'><a href='#'><span>Sub Item</span></a></li>
</ul>
</li>
</ul>
</li>
<li><a href='#'><span>About</span></a></li>
<li class='last'><a href='#'><span>Contact</span></a></li>
</ul>
</div>
Here is the css
<style media="screen" type="text/css">
#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {
margin: 0;
padding: 0;
position: relative;
}
#cssmenu {
height: 49px;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
background: #fefefe;
background: -moz-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #eee9f0));
background: -webkit-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: -o-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: -ms-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: linear-gradient(top, #fefefe 0%, #eee9f0 100%);
border-bottom: 2px solid #db000b;
width: auto;
}
#cssmenu:after,
#cssmenu ul:after {
content: '';
display: block;
clear: both;
}
#cssmenu a {
background: #fefefe;
background: -moz-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #ececec));
background: -webkit-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: -o-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: -ms-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: linear-gradient(top, #fefefe 0%, #ececec 100%);
color: #000;
display: inline-block;
font-family: Helvetica, Arial, Verdana, sans-serif;
font-size: 12px;
line-height: 49px;
padding: 0 20px;
text-decoration: none;
}
#cssmenu ul {
list-style: none;
}
#cssmenu > ul {
float: left;
}
#cssmenu > ul > li {
float: left;
}
#cssmenu > ul > li > a {
color: #000;
font-size: 12px;
}
#cssmenu > ul > li:hover:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #db000b;
margin-left: -10px;
}
#cssmenu > ul > li:first-child > a {
border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
}
#cssmenu > ul > li.active:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #db000b;
margin-left: -10px;
}
#cssmenu > ul > li.active > a {
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
background: #ececec;
background: -moz-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #ffeeff ef));
background: -webkit-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -o-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -ms-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
}
#cssmenu > ul > li:hover > a {
background: #ececec;
background: -moz-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #ffeeff ef));
background: -webkit-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -o-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -ms-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
}
#cssmenu .has-sub {
z-index: 1;
}
#cssmenu .has-sub:hover > ul {
display: block;
}
#cssmenu .has-sub ul {
display: none;
position: absolute;
width: 200px;
top: 100%;
left: 0;
}
#cssmenu .has-sub ul li {
*margin-bottom: -1px;
}
#cssmenu .has-sub ul li a {
background: #db000b;
border-bottom: 1px dotted #ff0f1b;
filter: none;
font-size: 11px;
display: block;
line-height: 120%;
padding: 10px;
color: #ffffff;
}
#cssmenu .has-sub ul li:hover a {
background: #a80008;
}
#cssmenu .has-sub .has-sub:hover > ul {
display: block;
}
#cssmenu .has-sub .has-sub ul {
display: none;
position: absolute;
left: 100%;
top: 0;
}
#cssmenu .has-sub .has-sub ul li a {
background: #a80008;
border-bottom: 1px dotted #ff0f1b;
}
#cssmenu .has-sub .has-sub ul li a:hover {
background: #8f0007;
}
</style>
When you wrote 'smooth CSS menu' you meant without javascript and only CSS ?
If so, use css level 3 transition.
#cssmenu ul ul {
/* this will apply to inner UL, adapt to your desired selector */
-webkit-transition: height 0.3s ease-in-out;
-o-transition: height 0.3s ease-in-out;
-moz-transition: height 0.3s ease-in-out;
transition: height 0.3s ease-in-out;
}
[EDIT]
If it is not working for your context, perhaps it is because there is no 'height to your inner UL element.
#cssmenu .has-sub:hover > ul {
display: block;
height:auto; /* add this */
}
#cssmenu .has-sub ul {
display: none;
position: absolute;
width: 200px;
height:0; /* add this */
top: 100%;
left: 0;
}
For more about the topic for a cross-browser solution, search the net for css transition generator
I'd recommend using something a little more extensive, such as jQuery, to give your desired effect. Here's a link to the 'accordion' effect that sounds like something you're going for. The layout of the accordion menu is completely adjustable - so don't worry if you don't like the design of the default layout.
http://jqueryui.com/accordion/#default
Adding jQuery to your webpage takes about 30 seconds, but gives you an eternity of useful additions, animations, and interactive content manipulation for your page!
u can use jquery for easing effects for your dropdwon menu here is one example
http://devsnippets.com/article/slick-drop-down-menu-with-easing-effect-using-jquery-css.html
I use this
http://cssdeck.com/labs/pure-css3-smooth-drop-down-menu
This menu is created only in CSS3 which is inspired from this post on Forrst! This consists of a nested ul structure to create the second level of the menu which is initially hidden with it's opacity set to 0. When the link is hovered, the respective ul shows up and slides down. This is achieved by setting its opacity to 1 and changing it's top offset when it's hovered in conjuction with the CSS3 transitions to animate the process smoothly.
Check out the code and play with it as much as you like :)
Related
I am attempting to center a drop down list, extending the grey rectangle across the screen while keeping the text in the direct center of the screen. There should only be three items at this time. These items are Home, Assignments and Projects.
Here's the html
<HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<link type="text/css" rel="stylesheet" href="http://jamcgraw.iweb.bsu.edu/assignments/stylesheet.css" />
<title>McGraw</title>
</head>
<div align="center">
<body>
<li>Home
</li>
<li>Assignments
<ul>
<li>
</li>
</ul>
</li>
<li>Projects
<ul>
<li><a href="http://jamcgraw.iweb.bsu.edu/projects/project1/project1.zip" target="_blank">
Project 1</a>
</li>
</ul>
</li>
</ul>
<br />
<br />
<h2>Some of my favorite websites include:<ul>
Facebook </br>
Reddit </br>
Twitch.tv </br>
Youtube </br>
Noxxic
</ul>
</h2>
</body>
</html>
and the .css for the DDM
/*Begin Theme Style Code*/
/*Begin Regular Code*/
* {
margin: 0px;
}
/*End Regular Code*/
/*Begin Menu code*/
#menu-container ul,
#menu-container li,
#menu-container span,
#menu-container a {
margin: 0;
padding: 0;
position: relative;
}
#menu-container {
/* EDITED : ADD THE FOLLOWING LINE */
text-align:center;
height: 49px;
border-radius: 0px 0px 0 0;
-moz-border-radius: 0px 0px 0 0;
-webkit-border-radius: 0px 0px 0 0;
background: #141414;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi+v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
border-bottom: 2px solid #0fa1e0;
}
#menu-container:after,
#menu-container ul:after {
content: '';
display: block;
clear: both;
}
#menu-container a {
background: #141414;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi+v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
color: #ffffff;
display: inline-block;
font-family: Helvetica, Arial, Verdana, sans-serif;
font-size: 12px;
line-height: 49px;
padding: 0 20px;
text-decoration: none;
}
#menu-container ul {
list-style: none;
}
#menu-container > ul {
}
#menu-container > ul > li {
/*EDITED : CHANGE THE FOLLOWING LINE*/
float: left;
}
#menu-container > ul > li:hover:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #0fa1e0;
margin-left: -10px;
}
#menu-container > ul > li:first-child > a {
border-radius: 0px 0 0 0;
-moz-border-radius: 0px 0 0 0;
-webkit-border-radius: 0px 0 0 0;
}
#menu-container > ul > li:last-child > a {
border-radius: 0 0px 0 0;
-moz-border-radius: 0 0px 0 0;
-webkit-border-radius: 0 0px 0 0;
}
#menu-container > ul > li.active > a {
box-shadow: inset 0 0 3px #000000;
-moz-box-shadow: inset 0 0 3px #000000;
-webkit-box-shadow: inset 0 0 3px #000000;
background: #070707; background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh+v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%;
background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
}
#menu-container > ul > li:hover > a {
background: #070707;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh+v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%;
background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
box-shadow: inset 0 0 3px #000000;
-moz-box-shadow: inset 0 0 3px #000000;
-webkit-box-shadow: inset 0 0 3px #000000;
}
#menu-container .has-sub {
z-index: 1;
}
#menu-container .has-sub:hover > ul {
display: block;
}
#menu-container .has-sub ul {
display: none;
position: absolute;
width: 200px;
top: 100%;
left: 0;
}
#menu-container .has-sub ul li {
*margin-bottom: -1px;
}
#menu-container .has-sub ul li a {
background: #0fa1e0;
border-bottom: 1px dotted #6fc7ec;
filter: none;
font-size: 11px;
display: block;
line-height: 120%;
padding: 10px;
}
#menu-container .has-sub ul li:hover a {
background: #0c7fb0;
}
#menu-container .has-sub .has-sub:hover > ul {
display: block;
}
#menu-container .has-sub .has-sub ul {
display: none;
position: absolute;
left: 100%;
top: 0;
}
#menu-container .has-sub .has-sub ul li a {
background: #0c7fb0;
border-bottom: 1px dotted #6db2d0;
}
#menu-container .has-sub .has-sub ul li a:hover {
background: #095c80;
}
#menu-container {
-moz-box-shadow: 0 0 10px #888;
-webkit-box-shadow: 0 0 10px #888;
box-shadow: 0 0 10px #888;
}
/*End Menu Code*/
/*Begin Button Code*/
button.button {
border: 0 none;
font-size: 16px;
font-weight: 600;
height: 34px;
line-height: 22px;
margin-bottom: 5px;
margin-left: 0;
margin-right: 1px;
padding: 4px 11px 10px;
color: #FFFFFF;
background-color: #00CCFF;
font-family: Segoe UI, Tahoma, Helvetica, sans-serif;
}
button.button:hover {
background-color:#24459A
}
/*End Button Code*/
/*Begin Table Logo Code*/
table.header {
width: 100%;
border-collapse: collapse;
border: none;
}
table.header td {
vertical-align: top;
border: 1px solid #BFBFBF;
padding: -1px;
}
table.header td.center {
width: 800px;
height: 600px;
}
img.logo {
display: block;
margin-left: auto;
margin-right: auto;
}
/*End Table Logo Code*/
/*End Theme Style Code*/
JSFiddle
I mostly fixed your code as it was a mess.
The solution I used to center the list was:
display: table;
That should fix your problems.
My website midwestwindowbroker.com is having an issue on my mobile phone (iPhone 6) where it is defaulting to a smaller screen size. When I test it on desktop with a small screen size, it adjusts perfectly, however, on the actual mobile device it is minimizing more than it should. I have been adjusting the media queries it for some time trying to find the piece that adjusts the issue but haven't found it.
I am pretty sure that the responsive menu (which I did not build) is throwing it off but as I read through the CSS I can't see where it would be.
Menu CSS:
#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {margin: 0;
padding: 0;
position: relative;
z-index:50;}
#cssmenu:after,
#cssmenu ul:after {content: '';
display: block;
clear: both;}
#cssmenu a {color: #333333;
display: inline-block;
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;
font-size: 12px;
min-width: 35px;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 0 #eeeeee;}
#cssmenu ul {list-style: none;}
#cssmenu > ul > li {float: left;}
#cssmenu > ul > li.active > a {
background: #d9d9d9 url(images/grad_light.png) repeat-x left bottom;
background: -moz-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #d9d9d9), color-stop(100%, #bfbfbf));
background: -webkit-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: -o-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: -ms-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: linear-gradient(to bottom, #d9d9d9 0%, #bfbfbf 100%);
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#d9d9d9', endColorstr='#bfbfbf', GradientType=0);
box-shadow: inset 0 0 10px #979797, inset 0 10px 10px #979797;
-moz-box-shadow: inset 0 0 10px #979797, inset 0 10px 10px #979797;
-webkit-box-shadow: inset 0 0 10px #979797, inset 0 10px 10px #979797;
filter: none;}
#cssmenu > ul > li.active a:hover {
background: -moz-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #d9d9d9), color-stop(100%, #bfbfbf));
background: -webkit-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: -o-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: -ms-linear-gradient(top, #d9d9d9 0%, #bfbfbf 100%);
background: linear-gradient(to bottom, #d9d9d9 0%, #bfbfbf 100%);
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#d9d9d9', endColorstr='#bfbfbf', GradientType=0);
filter: none;}
#cssmenu > ul > li a {
box-shadow: inset 0 0 0 1px #ffffff;
-moz-box-shadow: inset 0 0 0 1px #ffffff;
-webkit-box-shadow: inset 0 0 0 1px #ffffff;
background: #bfbfbf url(images/grad_light.png) repeat-x left top;
background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 50%, #d7d7d7 51%, #ededed 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(50%, #e5e5e5), color-stop(51%, #d7d7d7), color-stop(100%, #ededed));
background: -webkit-linear-gradient(top, #ffffff 0%, #e5e5e5 50%, #d7d7d7 51%, #ededed 100%);
background: -o-linear-gradient(top, #ffffff 0%, #e5e5e5 50%, #d7d7d7 51%, #ededed 100%);
background: -ms-linear-gradient(top, #ffffff 0%, #e5e5e5 50%, #d7d7d7 51%, #ededed 100%);
background: linear-gradient(to bottom, #ffffff 0%, #e5e5e5 50%, #d7d7d7 51%, #ededed 100%);
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
border-bottom: 1px solid #d2d2d2;
border-top: 1px solid #d2d2d2;
border-right: 1px solid #d2d2d2;
line-height: 34px;
padding: 0 35px;
filter: none;}
#cssmenu > ul > li a:hover {
background: #ffffff url(images/grad_light.png) repeat-x left bottom;
background: -moz-linear-gradient(top, #d9d9d9 0%, #bfbfbf 50%, #b0b0b0 51%, #c7c7c7 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #d9d9d9), color-stop(50%, #bfbfbf), color-stop(51%, #b0b0b0), color-stop(100%, #c7c7c7));
background: -webkit-linear-gradient(top, #d9d9d9 0%, #bfbfbf 50%, #b0b0b0 51%, #c7c7c7 100%);
background: -o-linear-gradient(top, #d9d9d9 0%, #bfbfbf 50%, #b0b0b0 51%, #c7c7c7 100%);
background: -ms-linear-gradient(top, #d9d9d9 0%, #bfbfbf 50%, #b0b0b0 51%, #c7c7c7 100%);
background: linear-gradient(to bottom, #d9d9d9 0%, #bfbfbf 50%, #b0b0b0 51%, #c7c7c7 100%);
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
filter: none;}
#cssmenu > ul > li:first-child a {
border-radius: 5px 0 0 5px;
-moz-border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
border-left: 1px solid #d2d2d2;}
#cssmenu > ul > li:last-child a {
border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;}
#cssmenu .has-sub:hover ul {display: block;}
#cssmenu .has-sub ul {display: none;
position: absolute;
top: 36px;
left: -1px;
min-width: 100%;
text-align: center;
*width: 100%;}
#cssmenu .has-sub ul li {text-align: center;}
#cssmenu .has-sub ul li a {border-top: 0 none;
border-left: 1px solid #d2d2d2;
display: block;
font-size: 12px;
line-height: 120%;
padding: 9px 5px;
text-align: center;}
Page CSS:
.content ul, .content ol {padding: 0 15px 15px 40px; }
ul.nav {list-style: none;
margin-bottom: 15px;}
ul.nav li { }
ul.nav a, ul.nav a:visited {
padding: 5px 5px 5px 15px;
display: block;
width: 160px;
text-decoration: none;}
ul.nav a:hover, ul.nav a:active, ul.nav a:focus {background: #ccc;
color: #CCC;}
.image {margin: 0px 10px 0px 0px;}
/* ~~ miscellaneous float/clear classes ~~ */
.ia-container {width: 730px;
margin: 0 0 0px -20px;
overflow: hidden;}
.ia-container figure {position: absolute;
top: 0;
left: 50px;
width: 380px;
box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
transition: all 0.3s ease-in-out;}
.ia-container > figure {position: relative;
left: 0 !important;}
.ia-container img {display: block;
width: 100%;}
.ia-container input {position: absolute;
top: 0;
left: 0;
width: 50px;
height: 100%;
cursor: pointer;
border: 0;
padding: 0;
opacity: 0;
z-index: 100;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;}
.ia-container input:checked{width: 5px;
left: auto;
right: 0px;}
.ia-container input:checked ~ figure {left: 330px;
transition: all 0.7s ease-in-out;}
.ia-container figcaption {width: 100%;
height: 100%;
background: none;
position: absolute;
top: 0px;
transition: all 0.2s linear;}
.ia-container figcaption span {position: absolute;
top: 30%;
margin-top: -30px;
right: 20px;
left: 20px;
overflow: hidden;
text-align: center;
line-height: 20px;
font-size: 18px;
opacity: 0;
text-transform: uppercase;
letter-spacing: 4px;
font-weight: 700;
padding: 20px;
color: #fff;
text-shadow: 1px 1px 1px rgba(0,0,0,0.1);}
.ia-container input:checked + figcaption,
.ia-container input:checked:hover + figcaption{background: rgba(87, 73, 81, 0);}
.ia-container input:checked + figcaption span {transition: all 0.4s ease-in-out 0.5s;
opacity: 1;
top: 50%;}
ia-container #ia-selector-last:checked + figcaption span {transition-delay: 0.3s;}
.ia-container input:hover + figcaption {background: rgba(87, 73, 81, 0.03);}
.ia-container input:checked ~ figure input{z-index: 1;}
#media screen and (max-width: 720px) {
.ia-container {width: 540px;}
.ia-container figure {left: 40px;
width: 260px;}
.ia-container input {width: 40px;}
.ia-container input:checked ~ figure {left: 260px;}
.ia-container figcaption span {font-size: 16px;}}
#media screen and (max-width: 374px) {
.ia-container {width: 320px;}
.ia-container figure {left: 20px;
width: 180px;}
.ia-container input {width: 20px;}
.ia-container input:checked ~ figure {left: 180px;}
.ia-container figcaption span {font-size: 12px;
letter-spacing: 2px;
padding: 10px;
margin-top: -20px;}
.mybgcarousel {display:none;}}
You logo image is having width:506; in mobile view change it to width:100%; it will work.
a img {
width: 100%; // added this
border: none;
}
I found a fix on the iOS Developer Library. In my html under,
<meta name="viewport" content="initial-scale=1.0">
I needed to add:
<meta name="viewport" content="width=590">
I have an issue with my CSS. The menu works fine but when you adjust the window from full screen to any other size, the menu cuts off at the right end and starts again on the left below the menu. I had a similar issue with a different page and I was able to fix it with position:absolute but this doesn't seem to resolve this. I'm not a beginner but I'm not a pro. If someone could help me figure out how to make the window scroll left to right instead of moving the menu options down, that would be great.
I have a div tag that my css menu goes in:
<div id='cssmenu' align='justify' style="z-index: 1;">
Then I have multiple menu's that go across the top of the page
<ul><br>
<li class='has-sub'> ~a href='index.html'>Home ~/a> ~/li>
<li class='has-sub'> ~a href='index.html'>General Info~/a> ~/li>
<li class='has-sub'> ~a href='index.html'>Downloads~/a> ~/li>
<li class='has-sub'> ~a href='index.html'> ~/a> ~/li>
<li class='has-sub'> ~a href='index.html'>Home ~/a> ~/li>
<li class='has-sub'> ~a href='index.html'>Home ~/a> ~/li>
<ul>
</code>
Here is my CSS.
#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {
margin: auto;
padding: 0;
position: relative;
top: o;
z-index: 1;
}
#cssmenu {
height: 49px;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
background: #fefefe;
background: -moz-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #eee9f0));
background: -webkit-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: -o-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: -ms-linear-gradient(top, #fefefe 0%, #eee9f0 100%);
background: linear-gradient(top, #fefefe 0%, #eee9f0 100%);
border-bottom: 2px solid #a30813;
width: auto;
z-index: 1;
}
#cssmenu:after,
#cssmenu ul:after {
content: '';
display: block;
clear: both;
z-index: 1;
}
#cssmenu a {
background: #fefefe;
background: -moz-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fefefe), color-stop(100%, #ececec));
background: -webkit-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: -o-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: -ms-linear-gradient(top, #fefefe 0%, #ececec 100%);
background: linear-gradient(top, #fefefe 0%, #ececec 100%);
color: #000;
display: inline-block;
font-family: Helvetica, Arial, Verdana, sans-serif;
font-size: 12px;
line-height: 49px;
padding: 0 20px;
text-decoration: none;
z-index: 1;
}
#cssmenu ul {
list-style: none;
z-index: 1;
}
#cssmenu > ul {
float: left;
z-index: 1;
}
#cssmenu > ul > li {
float: left;
padding-left: 45px; /* This value moves the menu to the left*/
z-index: 1;
position: relative;
}
#cssmenu > ul > li > a {
color: #000;
font-size: 12px;
z-index: 1;
position: relative;
display:block;
}
#cssmenu > ul > li:hover:after {
content: '';
display: relative;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
z-index: 0 !important;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #a30813;
margin-left: -10px;
float:left;
margin-top:0px !important;
z-index: 1;
}
#cssmenu > ul > li:first-child > a {
border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
float:left;
margin-top:0px !important;
z-index: 1;
}
#cssmenu > ul > li.active:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
z-index: 1;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #a30813;
margin-left: -10px;
float:left;
margin-top:0px !important;
z-index: 1;
}
#cssmenu > ul > li.active > a {
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
background: #ececec;
background: -moz-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #ffeeff ef));
background: -webkit-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -o-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -ms-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
z-index: 1;
margin-top:0px !important;
z-index: 1;
}
#cssmenu > ul > li:hover > a {
background: #ececec;
background: -moz-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ececec), color-stop(100%, #ffeeff ef));
background: -webkit-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -o-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: -ms-linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
background: linear-gradient(top, #ececec 0%, #ffeeff ef 100%);
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
z-index: 1;
margin-top:0px !important;
z-index: 1 !important;
}
#cssmenu .has-sub {
z-index: 1;
padding-left: 50px;
z-index: 1;
}
#cssmenu .has-sub:hover > ul {
display: block;
z-index: 1;
padding-left: 50px;/* this value is used to align the menu*/
z-index: 1;
}
#cssmenu .has-sub ul {
display: none;
position: absolute;
width: 200px;
top: 100%;
left: 0;
z-index: 1;
}
#cssmenu .has-sub ul li {
*margin-bottom: -1px;
z-index: 1;
padding-left: 0px;
z-index: 1;
}
#cssmenu .has-sub ul li a {
background: #a30813;
border-bottom: 1px dotted #d40a19;
filter: none;
font-size: 11px;
display: block;
line-height: 120%;
padding: 10px;
color: #ffffff;
top:0;
z-index: 1;
}
#cssmenu .has-sub ul li:hover a {
background: #72060d;
margin-top:0px !important;
z-index: 1 !important;
padding-left:55px; /*this value moves the text to the left when highlighted*/
}
#cssmenu .has-sub .has-sub:hover > ul {
display: block;
margin-top:0px !important;
z-index: 1 !important;
padding-left:0; /* this keeps the sub-menu close to the drop down menu*/
}
#cssmenu .has-sub .has-sub ul {
display: none;
position: absolute;
left: 100%;
top:0;
z-index: 1;
}
#cssmenu .has-sub .has-sub ul li a {
background: #72060d;
border-bottom: 1px dotted #d40a19;
padding-left:5px; /* this aligns the txt to the left for the sub-menu */
z-index: 1;
}
#cssmenu .has-sub .has-sub ul li a:hover {
background: #5a040b;
margin-top:0px !important;
z-index: 1 !important;
padding-left:50px; /* this moves the text on the sub-menu when hovered over*/
}
Basically, the <li> element is floating left-to-right. It breaks off and starts on a new row when the width of the combined list-elements exceeds that of the <ul>.
What you can do is give the <div> a width:100% and overflow:hidden, so that you cannot see anything drop and start a new row.
Then you can give the <ul> a width:1000px, so that the <li> would be able to fit across the screen and be cut-off, but still somewhat visible. Here is what it would look like.
The problem after that is that you would need to resize the <li> items, either by font or padding; best to resize with media queries if working with multiple layouts. If you want them to resize dynamically, you can write a javascript function to handle the sizing/spacing.
I have an image I would like to apply to a submenu:
I have added css to apply it but is not working, How can I achieve something like?:
instead of
I have tried to put submenu to the left padding left <ul class="sub-menu" style="padding-left: -30px;"> but it does not work, to apply image I added
#menu ul.sub-menu li {
width: 200px;
background: no-repeat url(menu.png);
border-width: 0 1px 1px 1px;
border-style: solid;
}
But that does not work.
Here is html
<div id="menu">
<nav>
<ul style="padding-left: 0px;">
<li>menu 1
</li>
<li>menu 2
<ul class="sub-menu" style="padding-left: -30px;">
<li>1 submenu
</li>
<br/>
<li>2 submenu
</li>
<br/>
<li>3 submenu
</li>
<br/>
<li>4 submenu
</li>
<br/>
</ul>
</li>
<li>menu 3
</li>
<li>menu 4
</li>
<li>menu 5
</li>
<li>menu 6
</li>
<li>menu 7
</li>
</ul>
</nav>
</div>
here is css:
#menu {
width: 100%;
-webkit-box-shadow: 0px 1px 1px 0px rgba(250, 250, 250, .5);
-moz-box-shadow: 0px 1px 1px 0px rgba(250, 250, 250, .5);
box-shadow: 0px 1px 1px 0px rgba(250, 250, 250, .5);
padding-top: 15px;
}
hgroup, main, nav {
margin-bottom: 30px;
width: 100%;
background: -moz-linear-gradient(top, #353535 0%, #222222 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #353535), color-stop(100%, #222222));
background: -webkit-linear-gradient(top, #353535 0%, #222222 100%);
background: -o-linear-gradient(top, #353535 0%, #222222 100%);
background: -ms-linear-gradient(top, #353535 0%, #222222 100%);
background: linear-gradient(top, #353535 0%, #222222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#353535', endColorstr='#222222', GradientType=0);
border-top:1px solid #000;
border-bottom:1px solid #000;
}
nav ul {
height: 45px;
margin: 0 auto;
}
nav li {
float: left;
list-style-type:none;
}
nav li a {
display: inline-block;
width:auto;
padding: 0 12px;
height: 45px;
font: bold 14px'Arial', sans-serif;
color: #fff;
text-decoration: none;
text-align: center;
line-height: 48px;
text-shadow: 1px 1px 0px #111;
filter: dropshadow(color=#111, offx=1, offy=1);
border-left: 1px solid #444;
border-right: 1px solid #111;
background-color:#2B2B2B;
}
nav li a:hover {
background: -moz-linear-gradient(top, #444 0%, #222 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #444), color-stop(100%, #222));
background: -webkit-linear-gradient(top, #444 0%, #222 100%);
background: -o-linear-gradient(top, #444 0%, #222 100%);
background: -ms-linear-gradient(top, #444 0%, #222 100%);
background: linear-gradient(top, #444 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#444', endColorstr='#222', GradientType=0);
}
nav li a:active {
background: #222;
-webkit-box-shadow: inset 0px 0px 3px 1px rgba(0, 0, 0, .3);
-moz-box-shadow: inset 0px 0px 3px 1px rgba(0, 0, 0, .3);
box-shadow: inset 0px 0px 3px 1px rgba(0, 0, 0, .3);
}
nav li a:active:after {
content:"";
display: block;
width: 100%;
height: 4px;
position: relative;
bottom: 6px;
background: -moz-linear-gradient(top, #ff5e1f 0%, #ff3410 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ff5e1f), color-stop(100%, #ff3410));
background: -webkit-linear-gradient(top, #ff5e1f 0%, #ff3410 100%);
background: -o-linear-gradient(top, #ff5e1f 0%, #ff3410 100%);
background: -ms-linear-gradient(top, #ff5e1f 0%, #ff3410 100%);
background: linear-gradient(top, #ff5e1f 0%, #ff3410 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5e1f', endColorstr='#ff3410', GradientType=0);
}
#menu ul.sub-menu {
display: none;
position: absolute;
}
#menu ul.sub-menu li {
width: 200px;
background: no-repeat url(http://www.eurekavi.com/amores/images/menu.png);
border-width: 0 1px 1px 1px;
border-style: solid;
}
#menu ul.sub-menu li a {
text-align: center;
margin: 5px 10px;
padding: 5px 10px;
}
#menu ul.sub-menu li a:hover {
color: #FFF;
background-color: #b80063;
}
#menu li:hover ul.sub-menu {
display: block;
z-index: 90;
}
HERE IS jsfiddle
Made a couple changes which you can find here:
http://jsfiddle.net/wWx6f/
LexLusa's answer had the right idea but it was incomplete but I do want to give him/her credit. Like he said you can't just add the styling to each li or else the background gets applied to each list item.
You also need to remove this block because you no longer want the borders
/* Removed this because you don't want borders anymore
#menu ul.sub-menu li {
width: 200px;
border-width: 0 1px 1px 1px;
border-style: solid;
}
*/
Another issue that would come up was that because your submenus received the same styling as your main menu, it would get the black/gray box. In order to avoid this, you should make the styling more specific so the styling does not trickle down. You can do this by using the child operator
nav > ul > li > a {
However, you still wanted some of these stylings like the font text and the lineheight, so I simply added them in. I'm sure there is a more elegant solution but for now this works. If you want other stylings you can just add it here too.
/* copied stylings from parent */
#menu ul.sub-menu li a {
font: bold 14px'Arial', sans-serif;
color: #fff;
text-decoration: none;
text-align: center;
margin: 5px 10px;
padding: 5px 10px;
line-height: 48px;
text-shadow: 1px 1px 0px #111;
filter: dropshadow(color=#111, offx=1, offy=1);
}
You have to apply the background to the <ul>, not the <li>'s.
Givbe it a min-height to see the full bg-image and don't use the element style with the nagative padding.
#menu ul.sub-menu {
display: none;
position: absolute;
background: no-repeat url(http://www.eurekavi.com/amores/images/menu.png);
min-height: 264px;
margin: 0;
padding: 0;
}
Here you go:
http://jsfiddle.net/qGX5U/1/
Have you tried to set the background at the UL level? and then the LI's background: transparent? You could also set the UL background as a cover, like in http://css-tricks.com/perfect-full-page-background-image/?
First of all change this
#menu ul.sub-menu li {
width: 200px;
background: no-repeat url(http://www.eurekavi.com/amores/images/menu.png);
border-width: 0 1px 1px 1px;
border-style: solid;
}
to
#menu > ul > li {
width: 200px;
background: no-repeat url(http://www.eurekavi.com/amores/images/menu.png);
border-width: 0 1px 1px 1px;
border-style: solid;
}
So if you want to see my menu go here.
Since I know you'll want my source, here's the HTML:
<div id='menu-container'>
<ul id='menu' class="menu">
<li class='active'><a href='/'><span>Home</span></a></li>
<li class='has-sub'><a href='/games/'><span>Games</span></a>
<ul>
<li><a href='/games/dota-2/'><span>Dota 2</span></a></li>
<li><a href='/games/cs-go/'><span>CS: GO</span></a></li>
<li><a href='/games/css/'><span>CS: Source</span></a></li>
<li><a href='/games/terraria/'><span>Terraria</span></a></li>
<li class='last'><a href='/games/minecraft/'><span>Minecraft</span></a></li>
</ul>
</li>
<li class='has-sub'><a href='/about.html'><span>About Us</span></a>
<ul>
<li><a href='http://www.youtube.com/user/'><span>Our YouTube Channel</span></a></li>
<li><a href='/faq-list.html'><span>Our FAQs/Q&A List</span></a></li>
<li><a href='/feed-news.rss'><span>Our RSS Feed</span></a></li>
<li><a href='/wiki/'><span>Our Wiki</span></a></li>
<li><a href='/wiki/'><span>Our Blog</span></a></li>
<li class='last'><a href='/privacy.html'><span>Privacy Policy</span></a></li>
</ul>
</li>
<li class='has-sub last'><a href='/contact.html'><span>Contact Us</span></a>
<ul>
<li class='last'><a href='/forums/'><span>Forums</span></a></li>
</ul>
</li>
</ul>
And here's my CSS:
* {
margin: 0px;
}
#menu-container ul,
#menu-container li,
#menu-container span,
#menu-container a {
margin: 0;
padding: 0;
position: relative;
}
#menu-container {
height: 49px;
border-radius: 0px 0px 0 0;
-moz-border-radius: 0px 0px 0 0;
-webkit-border-radius: 0px 0px 0 0;
background: #141414;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi+v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
border-bottom: 2px solid #0fa1e0;
}
#menu-container:after,
#menu-container ul:after {
content: '';
display: block;
clear: both;
}
#menu-container a {
background: #141414;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALElEQVQImWMwMrJi+v//PxMDw3+m//8ZoPR/qBgDEhuXGLoeYswhXg8R5gAAdVpfoJ3dB5oAAAAASUVORK5CYII=) 100% 100%;
background: -moz-linear-gradient(top, #32323a 0%, #141414 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #32323a), color-stop(100%, #141414));
background: -webkit-linear-gradient(top, #32323a 0%, #141414 100%);
background: -o-linear-gradient(top, #32323a 0%, #141414 100%);
background: -ms-linear-gradient(top, #32323a 0%, #141414 100%);
background: linear-gradient(to bottom, #32323a 0%, #141414 100%);
color: #ffffff;
display: inline-block;
font-family: Helvetica, Arial, Verdana, sans-serif;
font-size: 12px;
line-height: 49px;
padding: 0 20px;
text-decoration: none;
}
#menu-container ul {
list-style: none;
}
#menu-container > ul {
float: left;
}
#menu-container > ul > li {
float: left;
}
#menu-container > ul > li:hover:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
bottom: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #0fa1e0;
margin-left: -10px;
}
#menu-container > ul > li:first-child > a {
border-radius: 0px 0 0 0;
-moz-border-radius: 0px 0 0 0;
-webkit-border-radius: 0px 0 0 0;
}
#menu-container > ul > li:last-child > a {
border-radius: 0 0px 0 0;
-moz-border-radius: 0 0px 0 0;
-webkit-border-radius: 0 0px 0 0;
}
#menu-container > ul > li.active > a {
box-shadow: inset 0 0 3px #000000;
-moz-box-shadow: inset 0 0 3px #000000;
-webkit-box-shadow: inset 0 0 3px #000000;
background: #070707;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh+v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%;
background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
}
#menu-container > ul > li:hover > a {
background: #070707;
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAxCAIAAACUDVRzAAAAA3NCSVQICAjb4U/gAAAALklEQVQImWNQU9Nh+v//PxMDw3+m//8ZkNj/mRgYIHxy5f//Z0BSi18e2TwS5QG4MGB54HL+mAAAAABJRU5ErkJggg==) 100% 100%;
background: -moz-linear-gradient(top, #26262c 0%, #070707 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #26262c), color-stop(100%, #070707));
background: -webkit-linear-gradient(top, #26262c 0%, #070707 100%);
background: -o-linear-gradient(top, #26262c 0%, #070707 100%);
background: -ms-linear-gradient(top, #26262c 0%, #070707 100%);
background: linear-gradient(to bottom, #26262c 0%, #070707 100%);
box-shadow: inset 0 0 3px #000000;
-moz-box-shadow: inset 0 0 3px #000000;
-webkit-box-shadow: inset 0 0 3px #000000;
}
#menu-container .has-sub {
z-index: 1;
}
#menu-container .has-sub:hover > ul {
display: block;
}
#menu-container .has-sub ul {
display: none;
position: absolute;
width: 200px;
top: 100%;
left: 0;
}
#menu-container .has-sub ul li {
*margin-bottom: -1px;
}
#menu-container .has-sub ul li a {
background: #0fa1e0;
border-bottom: 1px dotted #6fc7ec;
filter: none;
font-size: 11px;
display: block;
line-height: 120%;
padding: 10px;
}
#menu-container .has-sub ul li:hover a {
background: #0c7fb0;
}
#menu-container .has-sub .has-sub:hover > ul {
display: block;
}
#menu-container .has-sub .has-sub ul {
display: none;
position: absolute;
left: 100%;
top: 0;
}
#menu-container .has-sub .has-sub ul li a {
background: #0c7fb0;
border-bottom: 1px dotted #6db2d0;
}
#menu-container .has-sub .has-sub ul li a:hover {
background: #095c80;
}
#menu-container {
-moz-box-shadow: 0 0 10px #888;
-webkit-box-shadow: 0 0 10px #888;
box-shadow: 0 0 10px #888;
}
It's much, but if I don't give it you'll report me so how to align the menu to the center of my page (since I didn't code this, it was my friend)? And I also want the menu only, without the empty grey space. Is it possible?
Here is a fiddle that shows you how to align your menu to the center of the screen. You can search for my changes in the css by searching for "EDITED". I marked all 3 changes that way.
Here is what I did.
1.Remove the rule that makes the whole menu float left :
#menu-container > ul {
float: left;
}
2.Specify on his parent element that you want it in the center of the page :
#menu-container {text-align:center;}
3.Then for each menu element, change the following rule :
#menu-container > ul > li {
float: left;
}
to
#menu-container > ul > li {
display: inline-block;
}
As for your last question (I also want the menu only, without the empty grey space), I don't understand what you mean. You want to remove the grey color from the menu bar?