rel vs abs positioning of submenus in float-centered table

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
hbrand
Advanced
Advanced
Posts: 10
Joined: Tue Oct 14, 2003 10:01 pm

rel vs abs positioning of submenus in float-centered table

Post by hbrand »

Hello,

Likely this has been asked about and resolved before, but I didn't find it.

When I place the entire menu in a table cell all is fine. When I float & center the table, the submenu values left= and top= naturally don't work correctly with different window widths as they refer to the coordinates of the entire browser window. I've worked around this before by not centering the table, but this time I'd really like to center the table in the browser window.

So...has anyone figured out how to get the submenus aligned exactly where you want them in a floating centered table?

Best,
Robert
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

Well, you could put the menu into the table and set it as position="relative" instead of using the absolute positioning with top and left.

In the table it will go where the table goes. A url with a sample of what you're doing so we can see it would help. See this info on positioning the menu relatively:

http://milonic.com/tablemenu/

Ruth
hbrand
Advanced
Advanced
Posts: 10
Joined: Tue Oct 14, 2003 10:01 pm

Post by hbrand »

Hi Ruth,

The table is fine relatively as are the submenus unless I need to move one of the submenus to the left a little. In this case there is a horizontal submenu that sticks out over the content box and looks UGLY! Therefore, I want to move it over a bit to the left, but if I invoke the left command then the submenu becomes absolutely fixed and moves accordingly way off to the left in the window. Sorry, there is no URL yet although I could put it on my production server if need be.

Robert
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Have you tried an offset in the submenu definition?

Code: Select all

left="offset=-5"
Assigning the offset value in the left property should offset the submenu left or right; negative values for left, positive for right.

Cheers,

Kevin
hbrand
Advanced
Advanced
Posts: 10
Joined: Tue Oct 14, 2003 10:01 pm

Post by hbrand »

yes, that is the point of my entire post. When you do this the submenu becomes absolute, such that if you use left="10", the submenu is 10 pixels from the left window margin.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

yes, that is the point of my entire post. When you do this the submenu becomes absolute, such that if you use left="10", the submenu is 10 pixels from the left window margin.
Hi Robert,

I think you may have misunderstood my suggestion. It's the "offset" part that makes the difference.

NOT left=10; That would, as you say, specify an absolute position. Instead, you can also use the left property to assign an offset from the position that the menu would normally take. For example,

left="offset=-10";

would bump the menu over 10 pixels to the left of it's "normal" position when it opens. Note the double quotes around the offset assignment. You would put this in the submenu definition.

Cheers,

Kevin
hbrand
Advanced
Advanced
Posts: 10
Joined: Tue Oct 14, 2003 10:01 pm

Post by hbrand »

Kevin,

I did misunderstand and obviously didn't read your post CLOSE ENOUGH!! That suggestion worked perfectly to correct the problem.

Thanks very much!

Robert
Post Reply