I've spent most of the day struggling with what I thought would be a
trivial problem.
I have a hidden element that appears, outside of the normal flow,
when the mouse hovers over an inline element. HOWEVER, I want the
hidden element positioned at a location of my choosing relative to
that inline element.
Is this possible?
The best I can do is use "position: absolute" on the hidden block
with no top/left position defined. The problem is, the block always
appears to the right of the inline element. I can't move it!!
What if I want the element to appear BELOW the inline element, lined
up with the left border of the element? How do I do that?
Example demo: http://sunshine.rahul.net/~unicorn/test2.html
(Test in Firefox or Opera; doesn't work in IE)
================================================== ==============
CSS:
ul { margin: 0; padding: 0; }
li { list-style: none; margin: 0; padding: 0; display: inline; }
li div { border: 1px solid red; display: none; position: absolute; }
li:hover div { display: inline; background: yellow; }
HTML:
<ul>
<li>item 1
<div>hidden<br>block 1</div></li>
<li>item2
<div>hidden<br>block 2</div></li>
</ul>
================================================== ==============
If I change the "li: hover div" definition to "display: block" then
the block always appears at the left edge of the page, not relative
to the inline element. Setting "position: relative" puts the hidden
element into the normal flow, which messes up the appearance of the
page; the element should be outside the normal flow.
Any suggestions? Help!
-Alex