I am creating a little website and I can't get the drop-down menu, which comes out of the "gallery" button when I hover on it, to overlay the paragraph below the menu instead of pushing the whole content down. I've already tried every combination of position: relative; z-index: 9999;
. However, when I set position: absolute;
for the <ul>
element it actually works, but messes up all the layout of <ul>
items. Please help me to get this done because I'm starting to bump my head... Here's my code. You can see how the paragraph goes down when you hover on the "gallery" button. I wish the paragaph stayed where it is and the drop-down menu overlayed it.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- Adding a timeout to a render function in ReactJS
This does not work on frame builds..
Example: you have two frames top with content in them and you have got a CSS dropdown menu on the top frame. When you come on the menu, the sub menu is not seen in front of the content page.
First position the parent element as
relative
to make it establish a new containing block for absolutely positioned descendants:Then, position the nested
<ul>
absolutely, addtop
,left
offsets as well aswidth
:Example Here
You need to set your .menu-item a relative position
and now you can set your
ul
toabsolute
position without messing up your layout.Here's an updated version of your fiddle