Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:17

newbie trying to center a menu on the page


Poster: jhherring
Dated: Friday July 30 2004 - 19:45:37 BST

I don't yet have the example code posted anywhere, and hope that I don't need to, just to answer something that's no doubt very very simple. I also know that this has been tackled before, many times, and I did read the FAQs, so at least I'm trying!

Anyway, placing the menu inside a table cell with align="center" doesn't do any good. Silly of me.

I even tried pasting the suggested

Code:
screenposition="center;middle";


into what I hope was the right place on the page. Nothing.

Obviously, I'm doing something wrong. Can anyone take pity on a newbie (signed up with Milonic just today) and tell me where, exactly, I should be placing the code to get the whole menu centered on the page?

I'd be eternally grateful.


Poster: Ruth
Dated: Friday July 30 2004 - 19:53:30 BST

You are placing the menu in a table, the position is relative. Align=center refers to the text not the menu. You can't use screenposition=center because it's in a table and again the position is relative. One option: in whichever table cell you want to place the menu and have it centered, make a nested table with one cell for the menu and align the table center.
Code:
<td>you want the menu here, so you put <table border="0" cellspacing="0" cellpadding="0" align="center"><tr><td>and place the menu inside this. This table would center in the other table's cell so the menu would be centered in that cell since it goes where this table is.</td></tr></table></td>

Hope that made sense.

Ruth

newbie trying to center a menu on the page


Poster: jhherring
Dated: Friday July 30 2004 - 20:48:54 BST

(a) Thank you very much for your reply.

(b) I'm sure you're on to something, but I still can't quite get it. You can now take a look at it yourself, if you'd be so kind:

http://www.johnherring.net/cypressbay/m ... t-001.html

Take a look at the source for the HTML file -- I commented out the table structure I copied from you, since I couldn't get it to work. You could remove the comments and see whether it works for you, or maybe the error in my code is something that will just leap out at you, since you know what this is supposed to look like.

I know that there's a top=0; and left=0; in the style, but playing with that didn't seem to help any.

Again, many thanks for whatever help you can offer.

I'm getting ready to tell the powers that be that we really should buy this product, and I want to get all the wrinkles ironed out first.

Looking forward to your reply.


Poster: Ruth
Dated: Saturday July 31 2004 - 0:35:35 BST

Uncomment your table, then remove the script calls from the table and put them all immediately after the body tag and before anything else. Then check this linkand the information on how to place a menu in the table. You cannot put just the code in and have it work in all browsers, it will work in some browsers, break in many others, and even become unusable in others. The only thing that goes in the table is the 'main' always visible menu, the one that would have all the submenus come off it. Look at the that table example page and see how they place the main menu inside script tags and also include the drawMenus(); The rest of the submenus remain in the data file and also keep a drawMenus(); and that file gets called with the other 3 files. Once it is placed like that and you also inlcude the extra table which you have centered from the previous post then the menu will center. Just for information, if you don't need to put it in a table, then you could use the screenposition="center" and it would place the menu in the exact center of the screen.

If you need more help, give a yell.

Ruth

newbie trying to center a menu on the page


Poster: jhherring
Dated: Saturday July 31 2004 - 11:11:48 BST

That was it!

You're right, of course. Everything you suggest leads me to what looks like the right solution. It's nothing short of amazing how well it seems to work! (I can't see the menus at all using Win/NN4.07 or Win/NN4.77, but that may be something I can live with.)

By the way, you mention needing to keep the drawMenus(); statement in BOTH the menu_data.js file AND the main HTML file, but when I did this I accidentally omitted it from the menu_data.js file and it still worked! Am I overlooking something?

I'll post the code later today, if you want to take a look.

But either way . . . .

Thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you!

newbie trying to center a menu on the page


Poster: jhherring
Dated: Saturday July 31 2004 - 22:59:13 BST

OK, here's the most up-to-date code I've got.

http://www.johnherring.net/cypressbay/m ... t-002.html


Everything looks great, thanks to your help, but I still wonder about the stuff I mentioned in my last post -- there NO drawMenus(); statement in the menu_data.js file (only in the HTML file), and things seem to work fine anyway.

Also, I notice while using Win/IE 6 that the first time you mouse over the "Home" menu, it sometimes looks a little "off" -- the right-hand vertical border for the whole drop-down menu looks like it's too far to the right. Just a couple of pixels. Mouse around with the other menus, though, and the problem with this one just magically goes away when you go back to it. This is something I can definitely live with, it's so small a thing.

Anyway, thanks to you, it seems to be doing what I need. Many, many thanks. I'm delighted.


Poster: Ruth
Dated: Thursday August 5 2004 - 18:41:07 BST

I don't know about leaving the drawMenus out of the js file. It may be that it will work in some browsers and not work in others, so I would suggest you leave it as the directions state since it is tested in browsers following those directions. I notice that the menu is right at the top of the page. If that is where it is going, I really suggest you remove it from the table and put in the code for screenposition. Putting it in tables works as noted but as new browsers come into being and old ones are changed something might happen. If you decide to use this then put the main menu back in the .js file, and in the definition where you list style= put in screenposition="top;center"; That will put the menu in the top and center of the screen no matter what size/resolution the screen might be. If you want it centered but maybe down some pixels you can do that also. You would specify the top position: top="whateverpixels"; and screenposition="center"; As for the netscape browsers, just so you know it works in Netscape4.79.

Ruth