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

Align Horizontal Menu to the Right in a DIV - RESOLVED


Poster: davebarnes
Dated: Tuesday January 19 2010 - 23:44:10 GMT

http://marketingtactics.com
looks OK in Firefox
does not in IE8

I cheated to get it looking OK in Firefox by making the DIV a particular width.
I spent an hour searching the Milonc website and this forum and could find my answer.

Question: How do I get the entire horizontal menu to align (or float) to the right in the DIV?

Re: Align Horizontal Menu to the Right in a DIV


Poster: davebarnes
Dated: Saturday January 23 2010 - 15:53:01 GMT

I added:
buildAfterLoad="true"; to the top of my Menu_Data file
position="relative"; to the main menu in the file

Screen shot of IE7 shows the problem is still there.
For me: Firefox has the menu flush right. Safari, IE7 and IE8 have it offset to the left by about 8px.
Attachment:
MT_IE7.gif.jpg

Re: Align Horizontal Menu to the Right in a DIV


Poster: Ruth
Dated: Saturday January 23 2010 - 7:05:55 GMT

Hi,

I don't have IE8 so it's hard for me to give any response. I tried 6 and 7 but it is working just like in FF. If you could give me a screenshot, or explain what is happening, I might be able to figure out what is up, many times I can do that just seeing what's happening. One thing I did notice is that you are calling the menu in a div, but you don't have it set up a relatively positioned menu. You have all menus in the same file and are not using the buildAfterLoad=true; nor do you have the main menu set as position='relative'; I have no idea if that is causing the problem or not.

Ruth

Re: Align Horizontal Menu to the Right in a DIV


Poster: Ruth
Dated: Saturday January 23 2010 - 21:37:31 GMT

Hi,

OK, just to be sure...are you saying you want the menu to be right up to the right border just like the grey box at the top is?

Ruth

Re: Align Horizontal Menu to the Right in a DIV


Poster: davebarnes
Dated: Saturday January 23 2010 - 23:15:17 GMT

Yes

Re: Align Horizontal Menu to the Right in a DIV


Poster: Ruth
Dated: Sunday January 24 2010 - 2:59:34 GMT

Hi,

OK, here is what I came up with for fixing this. Change the div to the following

Code:
<DIV style="MARGIN-TOP: 19px; FLOAT: right; WIDTH: 100%; HEIGHT: 23px; xbackground-color: #1A75CF;" align='right'>


Notice that I changed the width to 100%. The reason I did that is for people who have larger fonts. I set the fontsize in the menu to 150% and when this is done, if you leave the div at the 446 the menu expands to the right side in IE7, NN7.2, 9, Opera 9.5, 10, FF 1.5, 2.0.0.18, 3.0.8. The only ones it goes to the left is Safari 4, GoogleChrome 1x. So, making it 100% for the div works in all browsers with larger fonts with expansion to the left, the other way it only works in the two I mentioned that I have.

Hope this helps

Ruth

It is fixed


Poster: davebarnes
Dated: Sunday January 24 2010 - 3:37:15 GMT

Ruth,

Thank you very much for the SOLUTION.

My only problem--a very minor one--is that your solution uses a deprecated technique.
My code now reads: <div style="width:100%; height:23px; float:right; margin-top:19px;" align="right">
align="right" should not be necessary.

Sometimes, I just hate CSS.

thanks,
dave

Re: Align Horizontal Menu to the Right in a DIV - RESOLVED


Poster: Ruth
Dated: Sunday January 24 2010 - 5:47:32 GMT

A man after my own heart. The day I can find a tutorial which starts with one simple page layout and then using that same beginning layout adds to it building more involved ones so you can see from a single foundation what is going on, I might think about trying to learn css for page design. The day they actually create divs so they work with clear explanations of how they are working, I will go out there and learn some of it! :lol:

The problem has to be something in the css, that is, how the divs are supposed to work, and I will keep trying to find out what it is, but in the meantime this works. Yes, the tag is deprecated, but it's interesting that it actually works the same in both IE and FF, that is almost an unheard of occurrence. Hmmm, does that mean the problem, or rather how the divs work, is in css since both IE and FF work fine with the align=right, but neither work really correctly with just the float: right? I'll do some research and let you know, though it may take some time to find it. I'd like to know :)

Ruth

Re: Align Horizontal Menu to the Right in a DIV - RESOLVED


Poster: Ruth
Dated: Sunday January 24 2010 - 7:10:31 GMT

Well, I found a solution which doesn't use the deprecated align=right, following an example at w3 org, though this was for a paragraph with a span in it to move a letter all the way right, I tried it with the menu code, and it seemed to work in all the browsers I have. That should validate, I think. :)

Code:
<DIV style="MARGIN-TOP: 19px; FLOAT: right; WIDTH: 100%; HEIGHT: 23px; xbackground-color: #1A75CF;">
<!-- Milonic DHTML Website Navigation Menu Version 5.0+ Copyright 2005 (c) Milonic Solutions Limited (UK). -->
<SPAN style="float: right"><SCRIPT language=JavaScript src="milonic_menu_code.js" type=text/javascript></SCRIPT>

<SCRIPT language=JavaScript src="MainMenu_data.js" type=text/javascript></SCRIPT></SPAN>
</DIV>


Ruth

Re: Align Horizontal Menu to the Right in a DIV - RESOLVED


Poster: davebarnes
Dated: Sunday January 24 2010 - 16:32:58 GMT

Ruth,
The span works perfectly.
Thanks,
dave

By the way. XHTML requires that all attributes be in lower case. So, "MARGIN-TOP" should be "margin-top", etc.