Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:48
rel vs abs positioning of submenus in float-centered table
Poster: hbrand
Dated: Monday November 13 2006 - 22:23:52 GMT
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
Poster: Ruth
Dated: Monday November 13 2006 - 23:48:10 GMT
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://www.milonic.com/tablemenu/
Ruth
Poster: hbrand
Dated: Monday November 13 2006 - 23:58:16 GMT
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
Poster: kevin3442
Dated: Tuesday November 14 2006 - 0:37:55 GMT
Have you tried an offset in the submenu definition?
Code:
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
Poster: hbrand
Dated: Tuesday November 14 2006 - 0:51:07 GMT
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.
Poster: kevin3442
Dated: Tuesday November 14 2006 - 1:05:09 GMT
Quote:
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