Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Hovering elements over each other

Reply
Thread Tools

Hovering elements over each other

 
 
Shannon Cayze
Guest
Posts: n/a
 
      12-09-2008
Hello all,

Is there a way to hover one HTML element over another and reliably
position it within the page? I know how to set the z-index and
position style attributes to get the element to hover, but positioning
it accurately is another issue.

I got it to work in a standard HTML page, but when I sent that page to
my client they imported it to SharePoint. Since SharePoint adds
additional content to the page, all of my elements that were
absolutely positioned were offset. Also, since the z-index was set
manually, using javascript to set the position based on the
offsetParent doesn't work (I can't iteratively retrieve all offset
parents).

Is there a way to hover an element over another without setting the "z-
index" and "position" style attributes so that it maintains the same
parent structure?

Thanks,
Shannon
 
Reply With Quote
 
 
 
 
Shannon Cayze
Guest
Posts: n/a
 
      12-10-2008
Thanks, Ben. I'll give that a shot.

What happened was that my client sent me a PowerPoint presentation
with samples of what they wanted menu buttons to look like. When I
right-clicked in PowerPoint and chose "Save as Image", the text on the
buttons looked awful. Therefore, I tried saving just the menu button
background as an image and hovering an <a> element with the button's
text over the background image. I was able to position them absolutely
and exactly where I wanted them. However, as described in my original
post, any slight change of the content threw everything off, so it was
pretty unreliable.

I fixed the problem by doing a print screen of the PowerPoint
presentation and using Photoshop to save the images. Then the text
looked fine. However, this is something that may come in handy another
time and is helpful to know.

Thank you for your help,
Shannon
 
Reply With Quote
 
 
 
 
ksamdev
Guest
Posts: n/a
 
      12-14-2008
On Dec 9, 3:50*pm, Shannon Cayze <ca...@hotmail.com> wrote:
> Hello all,
>
> Is there a way to hover one HTML element over another and reliably
> position it within the page? I know how to set the z-index and
> position style attributes to get the element to hover, but positioning
> it accurately is another issue.
>
> I got it to work in a standard HTML page, but when I sent that page to
> my client they imported it to SharePoint. Since SharePoint adds
> additional content to the page, all of my elements that were
> absolutely positioned were offset. Also, since the z-index was set
> manually, using javascript to set the position based on the
> offsetParent doesn't work (I can't iteratively retrieve all offset
> parents).
>
> Is there a way to hover an element over another without setting the "z-
> index" and "position" style attributes so that it maintains the same
> parent structure?
>
> Thanks,
> Shannon


Suppose you want to add title to image. This is similar to your
problem, right?

Then I'd do next thing:

<div style='position:relative'>
<img style='width:100px' src='url'>
<span style='position:absolute;left:0px;right:0px;bottom :0px'>Title</
span>
</div>

The idea is that you add wrapper as div around element. In given
solution you do not even need to play with z-index and Title is
automatically fixed to the bottom of wrapper that makes effect of
hovering one element by another.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date not appearing when hovering mouse over clock in sys tray John Computer Support 4 07-18-2007 04:58 AM
Gmail - hovering contact info on mouse over - how to get rid of?? jeff@msn.com.net Computer Support 4 02-17-2006 05:22 AM
"Floating Layer" when hovering over a LinkButton GD ASP .Net 4 09-13-2005 09:42 PM
Can I change the mousepointer while hovering over datagrid? jef ASP .Net Datagrid Control 1 04-12-2005 10:57 AM
Hiding 'insert' curson when hovering over text Paul M. Javascript 1 07-24-2003 09:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57