if you open the following link
http://dev.scopedesign.com/client/nyfarmersmarket_02/
you find an navigation bar if you go on "ABOUT US" you will see a drop down..
then you se the problem in drop down
now i want to give you a little idea from how i make this..
I am working on joomla CMS, & i do some changes in navigation module to get my style now the follwing CSS i used for this.. the problem is it is displaying the .parent.active a
background in drop downs i dont want that for this purpose i made .parent.active a ul
but it doesnt work..
you can check this how it works by inspect element in the browser.
.parent.active a{
background-image:url(../images/selected.png);
background-repeat:repeat-x;
padding-top:13px;
padding-bottom:13px;
}
.parent.active a ul{
background-image:none !important;
background-repeat:none;
padding-top:0px !important;
padding-bottom:0px !important;!
}
.menusan
{
/* Use these parameters to positions your menu. */
position: absolute;
// left: 10px;
}
.menusan, .menusan li, .menusan li ul { /* all lists */
padding: 0;
margin: 0;
// list-style: none;
display:block;
float:left;
}
.menusan li a{
padding-left:20px;
padding-right:18px;
}
.menusan li a:hover{
background-image:url(../images/selected.png);
background-repeat:repeat-x;
padding-top:13px;
padding-bottom:13px;
}
.menusan li{ /* all list items */
padding-top:11px;
padding-bottom:11px;
// padding-left:20px;
// padding-right:18px;
-moz-border-right:#537d28 groove 2px;
border-right:#7cb43f groove 2px;
[border-right:#537d28 groove 2px;
border-right:#7cb43f groove 2px;/
border-right:#7cb43f groove 2px;]
}
.menusan li ul { /* second-level lists */
//top:35px;
margin-top:13px;
float:left;
position: absolute;
border: none;
left: -98%; /* Use left instead of display to hide menus; display: none isn’t read by screen readers. */
}
.menusan li ul li{
display:list-item;
float:none;
border: none;
background-color:#537d28;
color:#fff;
//padding:10px 10px 24px 10px;
}
.menusan li ul li:hover{
display:list-item;
float:none;
background-color:#96c73d;
}
.menusan li ul li a{
display:block;
float:left;
}
.menusan li ul li a:hover{
display:block;
float:left;
background-color:#96c73d;
}
.menusan li:hover ul, .menusan li.sfhover ul { /* lists nested under hovered list items */
left: auto; /* change is to 10px, 20px, etc for indenting the sub menu */
border: none;
display:block;
float:left;
}
/* **************** Dropdown Menu styling end here ***************/
One thing i specialy want to let you know guys that it is difficult to make div in it or cheange style name because it is a dynamic module.
Cleaned up and fixed your CSS, try this:
.navigation {
background-color:#537D28;
color:#fff;
float:left;
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
height:40px;
margin-bottom:0.6em;
width:100%;
}
.menusan {
margin: 0;
list-style-type: none;
font-weight:700;
float: left;
color:#fff;
}
.menusan > li {
margin:0;
float: left;
border-right:1px groove #7cb43f;
position:relative;
}
.menusan li a {
display:block;
height:40px;
line-height:40px;
padding:0 25px;
text-decoration:none;
color:#fff;
}
.menusan .active {
background: url("http://dev.scopedesign.com/client/nyfarmersmarket_02/templates/nyfm/images/selected.png") repeat-x center center;
}
.menusan li a:hover {
background: url("http://dev.scopedesign.com/client/nyfarmersmarket_02/templates/nyfm/images/selected.png") repeat-x center center;
}
.menusan li.parent ul {
position:absolute;
z-index:9999;
top:40px;
left:0;
display:none;
background-color:#537D28;
}
.menusan li.parent:hover ul {
display:block;
}
.menusan li.parent ul a {
float:left;
}
.menusan li.parent ul a:hover {
background-color:#70A835;
}
.menusan li.parent ul a {
width:55px;
}
Related
I just tried to remove the MagicLine that was built into my Wordpress theme by taking out the CSS code that I'll put below. It worked and the line is gone but now my navigation is all jumpy as you can see at the site: http://sheisbiddy.com/home/ Is there a better way to remove the line (I can't seem to find it in the piles of code that came with the theme) or anyway to get the menu back to normal? Thanks!
#navigation ul li#magic-line { position: absolute; left: 0; width: 100px; height: 4px; padding-left: 0; display: none; }
This is what is left for the navigation CSS:
#header {height: 100px; padding-top: 20px; margin: 0 auto; }
#logo { float:left; }
#logo { text-transform:capitalize; padding:35px 0; }
#logo img { max-width:100%; }
#navigation {float:right; margin-right:20px; }
#navigation ul { list-style:none; position:relative; }
#navigation ul li { float:left; padding-left:30px; font-size:12px; display:inline; position:relative; font-weight:bold; }
#navigation ul li a { color:#888; padding-bottom:10px; padding-top:35px; display:inline; }
#navigation ul li ul { position:absolute; border:1px solid #e9e9e9; display:none; left:15px; padding-bottom:15px; z-index:9999; }
#navigation ul li ul li { min-width:150px; margin-left:15px; margin-right:15px; padding:15px 0 10px 0; border-bottom:1px solid #f6f6f6; font-weight:normal; font-size:10px; }
#navigation ul li ul li:last-child { border:0; padding-bottom:0; }
#navigation ul li ul li a { border:0; display:inline; padding:0; }
#navigation li:hover ul { display:inline; }
#navigation select { display:none; -webkit-appearance: none; border-radius: 0; }
you have an errors in you CSS which causes the navigation to behave this way...
in style.dynamic.php file :
Lines : 94,96,104
#tagline { background-color:; }
#navigation ul li { padding-bottom:px; }
#navigation ul li a { padding-top:px; }
I know this question has been asked similar ways before, but I am not finding a solution. I am trying to get the submenu dropdown to appear when one hovers over the main navigation.
It is a standard wordpress nav menu that worked fine until a few days ago. .
The site is http://www.cktax.com/.
header nav .sub-menu a:hover{
color: #555;
}
header .sub-menu li:hover {
background:#eee;
border-radius:4px;
box-shadow:inset 0 0 2px #CCC;
}
nav > ul ul {
display:none;
}
.submenu {
overflow:hidden;
font-size:13px;
height:14px;
}
.submenu ul {
padding-bottom:1px;
}
.submenu strong {
float:left;
}
.submenu li {
float:left;
line-height:1em;
margin:0 16px;
}
header .sub-menu {
position:absolute;
background-color:#FFF;
z-index:2;
left:-12px;
top:40px;
width:220px;
box-shadow:0 0 3px #c3c3c3;
border-radius:8px;
padding:20px;
}
header .sub-menu a {
font-size:14px;
letter-spacing: .5pt;
display:inline-block;
width:100%;
padding:9px 10px;
}
header .sub-menu .sub-menu {
left:231px;
top:0;
}
header .sub-menu .sub-menu:before {
content:'';
}
header .sub-menu li {
position:relative;
margin:0;
}
I'm trying to create a horizontal menu with the width of the parent div and where the links are arranged in equal distances. Target is to create a navigation bar with a width of 900px. Maybe it is possible to realize it on another way? I'm a newbie in css and don't know how to fix my problem and hope you could help me!
#nav {
background:red;
width:900px;
}
ul#nav-bar, ul#nav-bar ul{
margin:0;
list-style:none;
padding:0;
background: white;
border: 1px solid black;
}
ul#nav-bar ul{
display:none;
position:absolute;
left:0;
}
ul#nav-bar li:hover>*{
display:block;
}
ul#nav-bar li{
position:relative;
display:block;
white-space:nowrap;
font-size:0;
float:left;
}
ul#nav-bar li:hover{
z-index:1;
}
ul#nav-bar{
font-size:0;
z-index:999;
position:relative;
display:inline-block;
zoom:1;
padding:0;
*display:inline;
}
* html ul#nav-bar li a{
display:inline-block;
}
ul#nav-bar>li{
margin:0;
}
ul#nav-bar a:active, ul#nav-bar a:focus{
outline-style:none;
}
ul#nav-bar a{
display:block;
vertical-align:middle;
text-align:center;
text-decoration:none;
font: 12px Arial;
color:#000000;
padding:5px 10px 5px 10px;
}
ul#nav-bar ul li{
float:none;
margin:0 0 0;
}
ul#nav-bar ul a{
text-align:left;
background-color:red;
color:#000;
}
ul#nav-bar li:hover>a{
background-color:#fff;
color:#000000;
}
ul#nav-bar span{
display:block;
overflow:visible;
background-position:right center;
background-repeat:no-repeat;
padding-right:0px;
}
<div id="nav">
<ul id="nav-bar">
<li>Link1</li>
<li><span>Link2</span>
<ul>
<li>lowerLink1</li>
<li>lowerLink2</li>
<li>lowerLink3</li>
</ul>
</li>
<li>Link3</li>
<li><span>longxxxxxxxxxxxxxxxxxxxxxxxxxxxlink</span>
<ul>
<li>lowerLink1</li>
<li>lowerLink2</li>
<li>lowerLink3</li>
</ul>
</li>
<li>Link5</li>
<li>Link6</li>
<li>longxxxxxxxxxxxxxlink</li>
</ul>
</div>
Thanks!
To get the #nav-bar to match the parent, simply add width:100% to your existing ul#nav-bar tag in css. This tells your child to fill up the parent, regardless of child's content.
As for spreading out the links, it has been my experience that the best way to do this is to add margins to the text once the navbar is complete. For your coded example, I would add the following to even them out:
ul#nav-bar->li{
margin:0px 20px 0px 20px;
text-align:center;
}
You can view it here and here is the css code
/*zero-height container problem fix for floated elements*/
.clearfix:before,
.clearfix:after {
content:"";
display:table;
}
.clearfix:after {
clear:both;
}
#nav {
background:#999;
width:900px;
}
#nav ul{
list-style: none;
padding: 0;
margin: 0;
}
#nav li{
position: relative;
text-align: center;
padding: 10px 0px;
}
#nav a{
text-decoration: none;
display: block;
color: #f0f0f0;
}
#nav-bar > li{
float: left;
}
#nav-bar ul{
position: absolute;
left: 0;
width: 100%;
top: 100%;
background: #999;
display: none;
}
#nav-bar li:hover{
background: #666;
}
#nav-bar li:hover ul{
display: block;
}
As if you want width to be adjusted to text width in li elements so you need javascript
and here is the code i have updated the jsfiddle
$(document).ready(function(){
total_nav_width = $('#nav').width();
main_link = $('#nav-bar > li > a')
textWidths = [];
totalTextWidth = 0;
main_link.each(function(){
textWidths.push($(this).width())
})
for (var i = 0; i < textWidths.length; i++) {
totalTextWidth += textWidths[i];
}
additionValues = (total_nav_width - totalTextWidth)/main_link.length;
main_link).each(function(){
intialWidth = $(this).width()
$(this).width( intialWidth + additionValues )
})
})
I'm a bit new to css. I'm trying to make a horizontal navigation bar with only 3 text items for mobile device viewing. I have width set to 100% and each section width set to 32% (I tried 33% but it would place the 3rd item on a new line.) It looks ok as it is, but when I hover (or click on using a mobile device) the background color changes and you can see the margins.
ul.nav {
width:100%;
margin:0 auto;
padding:0;
list-style:none;
display:inline-block;
background-color:#62564A;
text-align:center;
font-family: sans-serif;
}
.nav li {
display:inline;
}
.nav a {
width:33%;
text-align:center;
display:inline-block;
padding-bottom:13px;
padding-top:12px;
border-left: 1px solid #fff;
border-right: 1px solid #fff;
}
.nav a:hover {
background:#A26A42;
border:none;
width:32%
}
ul.nav li:first-child a{
border:none;
}
ul.nav li:last-child a {
border:none;
}
End of CSS
<ul class="nav">
<li>Search</li>
<li>Legend</li>
<li>Info</li>
</ul>
<div id="map_canvas" style="position:absolute;left:0;right:0;"></div>
Thank you for any help.
I'd rework your CSS like this jsFiddle example.
CSS
ul.nav {
width:100%;
margin:0 auto;
padding:0;
list-style:none;
background-color:#62564A;
text-align:center;
font-family: sans-serif;
}
.nav li {
display:inline-block;
width:33%;
margin:0;
padding:0;
}
.nav a {
text-align:center;
padding:12px 0 13px 0;
margin:0;
border-left: 1px solid #fff;
border-right: 1px solid #fff;
display:block;
}
.nav a:hover {
background:#A26A42;
border:none;
}
ul.nav li:first-child a{
border:none;
}
ul.nav li:last-child a {
border:none;
}
Try this:
* { margin:0; padding:0; } // This reset should go at the top of your CSS (if you don't have one already)
.nav li {
display:block;
float:left;
width: 33%;
}
.nav li a {
display:block;
text-align: center;
}
Fiddle: http://jsfiddle.net/kboucher/duaa6/
On "hover" you make the menu items narrower than normal. Plus you remove ther border which will narrow it even more. Also, It looks like you are using a 1px border left and right for spacing. If this is the case use margin instead. Use jsfiddle to practice.
Try this:
ul.nav {
width:100%;
margin:0;
padding:0;
list-style:none;
text-align:center;
font-family: sans-serif;
}
.nav li {
display:inline;
}
.nav a {
width:32%;
text-align:center;
display:inline-block;
padding-bottom:13px;
padding-top:12px;
margin-left: 1px;
background: #62564A;
}
.nav a:hover {
background:#A26A42;
}
ul.nav li:first-child a{
margin-left: 0;
}
http://jsfiddle.net/mVv75/4/
I have the following css code:
#menu li {
float:left;
position:relative;
line-height: 3em;
width: 10em;
}
#menu li ul {
position:absolute;
margin-top:0em;
margin-left:.0em;
display:none;
}
#menu ul li ul {
margin-top:0em;
margin-left:0em;
}
#menu a {
display:block;
border-right:1px solid #fff;
background:#3B3B3B;
color:#3B3B3B;
text-decoration:none;
padding:0 0px;
text-align:center;
background: url(images/nav.gif) repeat-x 0 0;
height: 50px;
list-style-type: none;
}
#menu a:hover {
background-color::#3B3B3B3;
color:#fff;
text-align:center;
height: 50px;
list-style-type: none;
}
#menu ul {
border-top:1px solid #fff;
float: right;
list-style-type: none;
}
#menu ul a {
border-right:none;
border-right:1px solid #fff;
border-bottom:1px solid #fff;
border-left:1px solid #fff;
background:#fff;
text-align:center;
background: url(images/nav.gif) repeat-x 0 0;
height: 50px;
}
/* SHOW SUBMENU 1 */
#menu li:hover ul, #menu li.over ul {
display:block;
background:#fff;
}
#menu li:hover ul ul, #menu li.over ul ul {
display:none;
}
/* SHOW SUBMENU 2 */
#menu ul li:hover ul, #menu ul li.over ul {
display:block;
}
and the following HTML code
<div class="shell">
<div class="cl"> </div>
<ul id="menu">
<li>HOME</li>
<li>
CLIENTS
<ul>
<li>CLIENT LIST</li>
The problem I am having is that when the I hover my mouse over the drop down tabs - "CLIENT LIST" - It gets displayed behind the images and text that are on my page. How do I bring it to front?
As I understand your menu is coming under images and text, which are placed on your page. and you want to display this menu over all the content of the page.
If so, then provide a higher z-index value to your menu from all the content.
like: .menutab { z-index : 1000;} where .menutab is a class which is on your menu element.
Edited : make change in this line
/* SHOW SUBMENU 1 */ #menu li:hover ul, #menu li.over ul
{ display:block; background:#fff;}
to
/* SHOW SUBMENU 1 */ #menu li:hover ul, #menu li.over ul
{ display:block; background:#fff; z-index:1000; }
It will solve your problem.
check this DEMO