Reputation: 4164
If you hover over the User
menu, then the menu shows up at left = 0. But, it should show up exactly under the User
'button'. How can I accomplish this? (only CSS3)
Upvotes: 1
Views: 270
Reputation: 78691
Add this rule to your CSS:
.menu > li {
position: relative;
}
Explanation: if you specify position: absolute
on an element, top
and left
will be relative to the first parent element that has any position
other than static
. If no element like that is found, it will be relative to the page (like in your case). Specifying position: relative
is the easiest solution because the element won't be taken out of the document flow.
Upvotes: 5