i have a problem with CSS white space between words of the menu bar. I tried numerous ways but still cant solve it. Can someone help me here?
The picture of the menu problem can be seen below:
http://imageshack.us/photo/my-images/201/44262065.jpg/
I want the outcome to be like this, lesser space between each menu:
http://i47.tinypic.com/2vvwcnn.jpg
Here is my css:
#cssmenu{
border:none;
border:0px;
margin:0px;
padding:0px;
font-family:verdana,geneva,arial,helvetica,sans-serif;
font-size:14px;
font-weight:bold;
color:8e8e8e;
}
#cssmenu ul{
background:url(img/menu-bg.gif) top left repeat-x;
height:43px;
list-style:none;
margin:0;
padding:0;
}
#cssmenu li{
float:left;
padding:0px 0px 0px 132px;
display: inline-block;
}
#cssmenu li a{
color:#666666;
display:block;
font-weight:bold;
line-height:43px;
padding:0px 0px;
text-align:left;
text-decoration:none;
}
#cssmenu li a:hover{
color:#000000;
text-decoration:none;
}
#cssmenu li ul{
background:#e0e0e0;
border-left:2px solid #f68618;
border-right:2px solid #f68618;
border-bottom:2px solid #f68618;
display:none;
height:auto;
filter:alpha(opacity=95);
opacity:0.95;
position:absolute;
width:180px;
z-index:200;
/*top:1em;
/*left:0;*/
}
#cssmenu li:hover ul{
display:block;
}
#cssmenu li li {
display:block;
float:none;
padding:0px;
width:180px;
}
#cssmenu li ul a{
display:block;
font-size:12px;
font-style:normal;
padding:0px 10px 0px 15px;
text-align:left;
}
#cssmenu li ul a:hover{
background:#949494;
color:#000000;
opacity:1.0;
filter:alpha(opacity=100);
}
#cssmenu p{
clear:left;
}
#cssmenu .active > a:hover {
color:#ffffff;
}
Here is my html code:
<div id='cssmenu'>
<ul>
<li><a href='index.php'><span>Home</span></a></li>
<li><a href='promotions.php'><span>Promotions</span></a></li>
<li><a href='outlets.php'><span>Outlets</span></a></li>
<li><a href='feedback.php'><span>Feedback</span></a></li>
<li class='has-sub '><a href='#'><span>Career</span></a>
<ul>
<li><a href='stall.php'><span>Stall Leasing</span></a></li>
<li><a href='career.php'><span>Career Opportunity</span></a></li>
</ul>
</li>
<li><a href='contactUs.php'><span>Contact Us</span></a></li>
</ul>
</div>
use this decrease your padding of li and line-height also
#cssmenu li{
float:left;
padding:30px;
display: inline-block;
}
Try removing the padding from .border class, row 311 in you blue round.css file
Related
I have created a Menu list.
It is working perfectly on Chrome and Firefox but misaligned in IE8
Chrome Snapshot :-
http://postimg.org/image/g6uf9zikr/
IE8 Snapshot :-
http://postimg.org/image/u6o3pzasz/
Here's my CSS ------
div.menu {
background-color:#383838;
height:65px;
margin-bottom:20px;
}
div.menu ul {
vertical-align:middle;
list-style:none;
margin:0;
padding:0;
}
div.menu ul li {
float:left;
display:block;
}
div.menu ul li a {
color:#FFFFFF;
display:block;
float:left;
font-family:"Trebuchet MS", Verdana, Arial;
font-weight:bold;
padding:24px 20px 22px;
text-transform:uppercase;
text-decoration:none;
}
div.menu ul li a:hover {
text-decoration:underline;
background-color:#2B2B2B;
}
div.menu ul li:hover ul {
display:block;
}
div.menu ul li ul {
vertical-align:middle;
text-align:center;
float: none;
list-style: none;
display: none;
position:absolute;
z-index:999;
margin-top:60px;
background-color:#383838;
opacity:0.8;
}
div.menu ul li ul li{
float: none;
vertical-align:middle;
background-color:#383838;
padding:15px;
}
div.menu ul li ul li a {
color:#FFFFFF;
font-family:"Trebuchet MS", Verdana, Arial;
font-weight:bold;
text-transform:uppercase;
padding:0px;
}
div.menu ul li ul li a:hover {
text-decoration:underline;
}
div.menu ul li ul li:hover{
background-color:#2B2B2B;
opacity:1.0;
}
<div class="menu">
<ul>
<li> HOME </li>
<li>CONTROLLER
<ul>
<li> CONTROLLER-1</li>
<li> CONTROLLER-2</li>
</ul></li>
<li>IOS BPL ZIO
<ul>
<li> IOS BPL ZIO-1</li>
<li> IOS BPL ZIO-2</li>
</ul></li>
</ul>
</div>
Please help me to resolve the issue.
Remove float: left from the links in the menu. This will cause those links to fill the entire row, and the ul of the submenu will not be shown next to it.
To counter that gap that causes, remove the margin-top from the submenu ul.
That should do the trick, although I don't have IE8 at hand to test it.
div.menu {
background-color:#383838;
height:65px;
margin-bottom:20px;
}
div.menu ul {
vertical-align:middle;
list-style:none;
margin:0;
padding:0;
}
div.menu ul li {
float:left;
display:block;
}
div.menu ul li a {
color:#FFFFFF;
display:block;
font-family:"Trebuchet MS", Verdana, Arial;
font-weight:bold;
padding:24px 20px 22px;
text-transform:uppercase;
text-decoration:none;
}
div.menu ul li a:hover {
text-decoration:underline;
background-color:#2B2B2B;
}
div.menu ul li:hover ul {
display:block;
}
div.menu ul li ul {
vertical-align:middle;
text-align:center;
float: none;
list-style: none;
display: none;
position:absolute;
z-index:999;
background-color:#383838;
opacity:0.8;
}
div.menu ul li ul li{
float: none;
vertical-align:middle;
background-color:#383838;
padding:15px;
}
div.menu ul li ul li a {
color:#FFFFFF;
font-family:"Trebuchet MS", Verdana, Arial;
font-weight:bold;
text-transform:uppercase;
padding:0px;
}
div.menu ul li ul li a:hover {
text-decoration:underline;
}
div.menu ul li ul li:hover{
background-color:#2B2B2B;
opacity:1.0;
}
<div class="menu">
<ul>
<li> HOME </li>
<li>CONTROLLER
<ul>
<li> CONTROLLER-1</li>
<li> CONTROLLER-2</li>
</ul></li>
<li>IOS BPL ZIO
<ul>
<li> IOS BPL ZIO-1</li>
<li> IOS BPL ZIO-2</li>
</ul></li>
</ul>
</div>
I have a demo here to illustrate my problem
http://www.ttmt.org.uk/
It's just a simple nav floated to the right and there is a drop down menu under 'Two'.
The drop down menu contain large buttons and I want the menu to stretch the with of the red bar above.
I got it working by giving the ul of the drop down menu a set with a negative left margin to pull it across.
#nav #topNav ul#fontSubMenu{
background:#e1e1e1;
left:-999em;
position:absolute;
padding:25px 0px 10px 22px;
margin:0 0 0 -784px;
z-index:120;
1width:100%;
width:1028px;
}
In Safari,Chrome (Mac) this seems to work but in Firefox it's a few pixels out.
Can anyone tell me why it's out in Firefox and is this the best way to do this.
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css">
<style type="text/css">
body{
font:1em Helvetica, sans-serif;
color:#555;
}
#wrap{
background:red;
margin:0 auto;
position:relative;
width:1050px;
}
#nav{
overflow:auto;
}
#nav #topNav{
float:right;
}
#nav #topNav li{
float:left;
margin:0 0 0 6px;
}
#nav #topNav li:hover,
#nav #topNav li a:hover{
background:#e1e1e1;
color:#555;
}
#nav #topNav li:hover .subNav{
border-bottom:6px solid #e1e1e1;
z-index:21;
}
#nav #topNav li a{
border-top:6px solid red;
border-bottom:6px solid red;
display:block;
padding:13px 13px;
color:white;
font-size:.98em;
font-weight:bold;
text-decoration:none;
}
#nav #topNav ul#fontSubMenu{
background:#e1e1e1;
left:-999em;
position:absolute;
padding:25px 0px 10px 22px;
margin:0 0 0 -784px;
z-index:120;
1width:100%;
width:1028px;
}
#nav #topNav li:hover ul#fontSubMenu{
left:auto;
}
#nav #topNav li ul#fontSubMenu li{
margin:0 14px 14px 0;
}
#nav #topNav li ul#fontSubMenu li a{
border: 1px solid #f7f7f7;
display:block;
color:#555;
position:relative;
font-size:.98em;
line-height:1.3em;
font-weight:normal;
width:162px;
height:45px;
}
#nav #topNav li ul#fontSubMenu li a em{
position:absolute;
left:75px;
bottom:13px;
width:100px;
font-style:normal;
}
#nav #topNav li ul#fontSubMenu li a:hover{
background:#aaa;
}
</style>
</head>
<body>
<div id="wrap">
<div id="nav">
<ul id="topNav">
<li>One</li>
<li >Two
<ul id="fontSubMenu">
<li><em>Two One</em></li>
<li><em>Two Two</em></li>
<li><em>Two Three</em></li>
<li><em>Two Four</em></li>
<li><em>Two Five</em></li>
<li><em>Two Six</em></li>
<li><em>Two Seven</em></li>
<li><em>Two Eight</em></li>
<li><em>Two Nine</em></li>
<li><em>Two Ten</em></li>
<li><em>Two Eeleven</em></li>
</ul>
</li>
<li >Three</li>
<li >Four</li>
<li >Five</li>
</ul>
</div><!--nav-->
</div><!--wrap-->
</body>
</html>
Why not use absolute positioning? The menu will always be on the same place, right?
ul#fontSubMenu{
left: 0;
top: 58px;
margin: 0;
}
(And remove the left: auto you set on the hover).
Your demo is also off by about 1-2px on Chrome Windows btw.
I am using ul li menu drop down for my site.. it displayed in ifrefox and chrome correctly. but in IE its not displayed...
my code like..,
<style type="text/css"> .nav { width:1000px; } .nav ul { }
.nav ul li { list-style: none;}
ul.dropdown { position:relative; width:auto; font:12px Arial, Helvetica, sans-serif; }
ul.dropdown li { float:left; zoom:1; height:30px; padding:6px 2px 0 2px; border-right:1px solid #bacfe4; }
ul.dropdown li li { border-right:1px solid #ccc; border-left:1px solid #ccc; margin-left:9px;}
ul.dropdown a:hover { color:#000; } ul.dropdown a:active { color:#ffa500; }
ul.dropdown li a { display:block; padding:4px 8px; color:#000; text-decoration:none; font:bold 12px Arial, Helvetica, sans-serif; }
ul.dropdown li:last-child a { border-right:none;}
ul.dropdown li:hover { color:#000; position:relative; }
ul.dropdown li.hover a { color:#000; }
ul.dropdown ul { text-align:left; visibility: hidden; position: absolute; left:-10px; top:36px; }
ul.dropdown ul li { border-bottom:1px solid #ccc; float:none; width:120px; height:25px; }
ul.dropdown ul li a { border-right:none; width:100%; display:inline-block; color:#000; }
ul.dropdown ul ul { left:100%; top:0; }
ul.dropdown li:hover > ul { visibility:visible; }
</style>
<script type="text/javascript">
</script>
<div class="nav">
<ul class='dropdown'>
<li><a href=''>one</a></li>
<li><a href=''>two</a></li>
<li> <a href=''> three </a>
<ul class='sub_menu'>
<li><a href=''>one3</a></li>
<li><a href=''>two3</a></li>
</ul>
</li>
</ul>
</div>
I included the jquery.js file two times in my actual page.
Thats why it was not displaying.
uMy child pages are showing up in a horizontal line under the parent page link in the navigation. I can't figure out where the css is wrong. You can see what I'm talking about here (the links under Sample Page are the ones in question): http://sitetest3.talktothedogs.com.
HTML for Navigation (which is auto-generated by WP)
<div id="nav">
<div class="menu">
<ul>
<li class="current_page_item">Home</li>
<li class="page_item page-item-2">Sample Page
<ul class='children'>
<li class="page_item page-item-4">Testing page 2</li>
<li class="page_item page-item-6">Testing page 1</li>
</ul>
</li>
</ul>
</div>
</div>
My CSS Code
.menu, .menu ul { margin:0; padding:0; list-style:none; height:29px; text-align:center; }
.menu a { color:#fff; display:block; padding-left:15px; padding-right:15px; padding-bottom:0px; }
.menu a:hover { color:#000; display:block; text-decoration:none; }
.menu li { float:left; margin:0; padding: 0px; }
.menu li li { float:left; margin: 0 0 0 5px; padding:0; width:130px; }
.menu li ul.submenu li { display:block; position:absolute; left:0; }
.menu li li a, .menu li li a:link, .menu li li a:visited { background:#a82652; width:150px; float:none; margin:0; padding: 4px 10px 5px 10px; color:#fff; }
.menu li li a:hover, .menu-header li li a:active { background:#000; width:150px; float: none; margin: 0; padding: 4px 10px 5px 10px; color:#fff; }
.menu li ul { position:absolute; width:10em; left:-999em; padding-top:13px; z-index:1; }
.menu li:hover ul { left:auto; display:block; }
.menu li:hover ul, #menu li.sfhover ul { left: auto; }
.menu li.current_page_item a { }
.menu li.current_page_item a:hover{ }
Any help would be appreciated. Thanks in advance!
Change your CSS as follows:
.menu li a{ margin-bottom:13px;}
.menu li li { float:none; margin: 0; padding:0; width:130px; }
Here is how this would look
Your first line in the CSS:
.menu, .menu ul { ... }
is setting the height of both the <div class="menu"> AND the <ul> within that .menu to the same height. The entire menu is constrained to a container that's 29px high.
I have a CSS driven simple drop down menu that can appear in double rows on narrower screens.
When I activate the dropdown of one of the top row items the drop down appears at the same "Z" level as the bottom row.
I thought I've set the z-indexes as required but it isn't working in Chrome, Firefox, Safari or iPhone.
Here is a sample: http://jsfiddle.net/bNBp3/ - "Meat" has a dropdown attached.
<ul id="main-navigation">
<li><span>Home</span>
</li>
<li><span>Meat</span>
<ul>
<li><span>Bacon</span></li>
<li><span>Ham</span></li>
<li><span>Pork</span></li>
</ul>
</li>
<li><span>Vegetables</span>
</li>
<li><span>About Us</span>
</li>
<li><span>Contact Us</span>
</li>
<li><span>A-Z</span>
</li>
</ul>
ul#main-navigation {
display:block;
border-bottom:1px solid #ccc;
margin:0 auto 0px auto;
min-height:21px;
padding:0;
width:100%;
z-index:11;
clear:both;
}
ul#main-navigation li {
display:block;
float:left;
list-style:none;
margin:0 5px 0 0;
padding:0;
position:relative;
z-index:12;
min-height:22px;
min-width:30%;
}
ul#main-navigation li a {
color:#000;
display:block;
padding:2px;
text-decoration:none;
z-index:13;
}
ul#main-navigation li a.current, ul#main-navigation li a.section {
color:#fff;
}
ul#main-navigation li ul {
background:#eee;
position:absolute;
left:-1px;
top:21px;
display:none;
overflow:hidden;
padding:0px;
z-index:14;
width:100%;
border:1px solid #ccc;
}
ul#main-navigation li ul li {
display:block;
float:none;
margin:0;
z-index:15;
width:100%;
border-bottom:1px solid #ccc;
}
ul#main-navigation li ul li a {
background:#eee;
display:block;
color:#333;
z-index:16;
zoom:100%;
}
ul#main-navigation li ul li a:hover {
background:#fff;
}
ul#main-navigation li:hover {
background:#eee;
border-left:1px solid #ccc;
border-right:1px solid #ccc;
}
ul#main-navigation li:hover a.current {
background:#eee; color:#000;
}
ul#main-navigation li:hover ul {
display:block;
}
Just get rid of all the z-index values and it works fine:
http://jsfiddle.net/bNBp3/12/
Tested in Chrome and Firefox6.
Edit: It seems I forgot to remove the z-index from ul#main-navigation li ul in the demo and that's what makes it work, so just set it to any value 1 or higher.