Reputation: 1031
Here is my code in FIDDLE
Here i have a demo div, If i select the menu product it should always select the sub menu starting like the above Demo div's start Point.
Here is my code.
CSS code for the sub menu:
ul li ul {
display: none;
width: 300px;
position: absolute;
left: 0;
margin-left: 8px;
}
Did i missed anything in my code.
Upvotes: 0
Views: 38
Reputation: 11808
When you write position:absolute
it take position relative to your browser window ,try position:relative
whic takes position relative to its parent
ul li ul {
display: none;
width: 300px;
position: relative;
left: 0;
margin-left: 0px;
}
Upvotes: 1
Reputation: 114377
ul li{
float: left;
width: 100px;
text-align: center;
position:relative; <---- add this
}
position:relative
sets the origin point for absolutely-positioned child elements.
Upvotes: 1