2

Hello all I have a sub menu that with a drop down menu but when the menu comes down it pushes the div below down. Any idea on how to fix so it loads over div?

and also one is horizontal and one is vertical how to fix that aswell thanks!

JSFiddle

    <ul class="proda">
    <li><a href="#" data-filter="*" class="current">All Categories</a></li>

    <li><a>Styles</a><b class="caret2"></b>
            <ul>
        <li><a href="#" data-filter=".slim">Slim</a></li>
        <li><a href="#" data-filter=".loose">loose</a></li>
        <li><a href="#" data-filter=".pro">proffesional</a></li>       
            </ul>               
    </li>

    <li><a>Brands</a><b class="caret2"></b>
      <ul>
        <li><a href="#" data-filter=".ses" class="current">LA Sesso</li>
        <li><a href="#" data-filter=".isa" class="current">Issah</li>
        <li><a href="#" data-filter=".ant" class="current">Antonio</li>
      </ul>           
    </li>
    <li><a href="#" data-filter=".seas">Seasonal</a></li>
    <li><a href="#" data-filter=".bnew">New</a></li>
</ul>
.proda{
    display: table-row;
    list-style: none;
}


.proda li ul { 
    background: #ccc;
    display: none; 
}

.proda li{
    display: table-cell;
    padding: 15px;
} 

.proda li a:hover{
    color: blue;
}

.proda li:hover ul { 
    position: relative;
    display: block; 
    z-index: 1;
 }

    display: block;
    background-color: #ecf0f1;

}
alfonsotorino
  • 33
  • 1
  • 5

7 Answers7

2
.proda li:hover ul { 
    position: absolute; //Changed
    display: block; 
    z-index: 1;
 }

change this in your css

Sweetz
  • 344
  • 1
  • 4
  • 17
1

Your CSS is all wrong. Define a dropdown class:

.dropdown{
 position: absolute;
display: none;
z-index: 99;
width: 150px;
}

Then give your line that class:

    <li class="dropdown"><a>Brands</a><b ></b>
  <ul>
    <li><a href="#" data-filter=".ses" class="current">LA Sesso</li>
    <li><a href="#" data-filter=".isa" class="current">Issah</li>
    <li><a href="#" data-filter=".ant" class="current">Antonio</li>
  </ul>           
</li>

And appropriately rearrange your navigation. Also, please use the nav tag.

Peter Noble
  • 675
  • 10
  • 21
0

try this code

.proda li:hover ul {
    display: block;
    position: absolute;
    z-index: 1;
}
Alex Wilson
  • 2,421
  • 11
  • 13
0

Yoo must change position of sub-menu to absolute. DEMO

Anon
  • 2,854
  • 14
  • 18
0

use position absolute for submenu ul

 proda li:hover ul {
 position: absolute;}

and position relative for menu li

proda li{ position: relative;}

http://jsfiddle.net/akash4pj/pc4xC/5/

0

JSFIDDLE

Remove position:relative from .proda li:hover ul instead use position:absolute.

So your css code will be like following:

    .proda li:hover ul { 
        position: absolute;
        display: block; 
        z-index: 1;
     }
Husen
  • 955
  • 1
  • 6
  • 16
0

Change remove property position: relative; from your selector .proda li:hover ul to get

        .proda li:hover ul {
            display: block;
            z-index: 1;
        }

Then add this other selector

        .proda>li>ul{
            position: absolute;
        }
Salathiel Genese
  • 1,639
  • 2
  • 21
  • 37