Drop down menu alignment problems. Div wont vertically align.

This is a discussion on "Drop down menu alignment problems. Div wont vertically align." within the Web Page Design section. This forum, and the thread "Drop down menu alignment problems. Div wont vertically align. are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Feb 27th, 2008, 06:01
Junior Member
Join Date: Jan 2008
Location: Melbourne
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Drop down menu alignment problems. Div wont vertically align.

Hi everyone.

Last time I posted stuff on here I got fantastic support and I've learnt a lot through the process. I'm now convinced that the designer view of Dreamweaver should only ever be used so that you can see your page take some form while you code your stylesheet!

I've been working on a new site and so far it's looking fairly right with a few issues.
Firstly my drop down menus are not aligning properly.

Secondly I have 2 other smaller menus that I want to sit directly above the drop down menus, either side of the logo.

The whole site can be seen here.

http://www.tourismaccreditationvic.c...ainLayout.html

On the page there is also 2 links to some mock up images of how I wanted the site to look at when I started. They show you what I mean about the menus.

I've already run the HTML and the CSS through the W3C validator and there's no errors showing up.

As always, anyone's assistance is appreciated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Feb 27th, 2008, 10:25
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

Hi Itsumishi

You have a lot of unnecessary code in there. Instead of wrapping all your lists in nested <div>'s, give the <ul> element the ID. Also, <div>'s like your #branding can be replaced with <h1> tags, and the text shifted using text-indent. Try replacing everything between
Code: Select all
<div id="TopLeftNav">
.
.
.
<li><a href="contact.html">Contact Us</a></li>
</ul>
</div>
With the following:
Code: Select all
<div id="banner">
    <h1>Service Skills Victoria</h1>
    <ul id="TopLeftNav">
        <li><a href="home.html">Home</a></li>
        <li><a href="faq.html">F.A.Q</a></li>
    </ul>
    <ul id="TopRightNav">
        <li><a href="about.html">About Us</a></li>
        <li><a href="contact.html">Contact Us</a></li>
    </ul>
</div>
Now add this CSS. This is only the positioning, so keep the styles for your nav menus.
Code: Select all
#banner {
    height: 125px;    
    position: relative;
}
#banner h1 {
    display: block;
    height: 125px;
    width: 230px;
    margin: 0 auto;
    text-indent: -5000px;
    background: url('../Images/SSV-Logo-Web.gif') no-repeat;
}
#TopLeftNav, #TopRightNav {
    position: absolute;
    bottom: 0;
}
#topLeftNav {
    left: 0;
}
#TopRightNav {
    right: 0;
}
Let me know how it works (If you can, upload the changes so I can see the issues)

Regarding your drop down menu, I'm not sure what the problem is. It might be worth trying Son of Suckerfish dropdowns. These will definitely work for sure.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Feb 28th, 2008, 00:37
Junior Member
Join Date: Jan 2008
Location: Melbourne
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

Alright.
I've gone through and done the code cleanups that you have suggested.

I've also tried to implement the multi-level Son of Suckerfish Menu.

I manually entered all the HTML and CSS, however when it got to the javascript I just did a simple Copy & Paste as I currently don't know anything about Javascript (and my brain is struggling a bit to keep up with all the HTML and CSS I've learnt in the last 4 weeks, so I figure I'll learn some Java once I've wrapped my head around the HTML and CSS a bit first). I did fix the ID tag in the Java, but apart from that it's exactly as I copied it.


However it seems that something in the Java is slightly incorrect becasue the CSS validator wouldn't even validate it;

Quote:
Servlet has thrown exception:javax.servlet.ServletException: Timed out
And in dreamweaver some of the brackets are showing up Red instead of their usual pink.

Code: Select all
sfHover = function() {
    var sfEls = document.getElementById("MainNav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
Currently the drop down menus have a few issues, some of them I'm sure I can work out easily however I'm a bit confused as to why the second level of dropm down isn't displaying directly next to the first level when hovering. This of course is a problem because the second the mouse moves over the gap in between the menus, the entire thing disapears meaning you can't get to the 2nd level of items.

Also the positioning of the top levels of links is still a bit funny. Whilst they both are down just above the drop down menu, they're not sitting on the left and right of the logo.

Also somewhere along the line my 'Wrapper' Div that was giving me a border and background colour around the Site Info and content pages seems to have stopped doing anything. I'm not sure why this has happened as I haven't adjusted this Div at all.

The link to the page is still the same

http://www.tourismaccreditationvic.c...ainLayout.html

Edit- Ooops almost forgot. I also had to add a few <p>&nbsp;</p>'s in above the links because when I lost the wrapper div everything also got pushed up underneith the banner. The Links should now be showing so you can see how the site will eventually look like.

Last edited by Itsumishi; Feb 28th, 2008 at 00:42. Reason: Fixed up link.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Feb 28th, 2008, 10:28
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

OK, not to worry! - Firstly, there's a small typo in your CSS

Line 104
Code: Select all
#TopLeftNav, #Topright Nav {
should be
Code: Select all
#TopLeftNav, #TopRightNav {
Notice the capitalization of the 'r' and no space?

Also, on line 147
Code: Select all
widows: 20em
when it should be
Code: Select all
width: 20em
Javascript is entirely different to CSS. You cannot put it in a stylesheet. It must be embedded in the HTML or, preferably, in an external file. (Note: the javascript is only required for it to work in IE6)

One more thing. Your HTML was also invalid. If you're using an xHTML doctype, all open ended tags must be closed using /> (fixed - see below)

I'll try and fix the menu and upload it. For now, here's the fixes mentioned above.
Attached Files
File Type: css Styles.css (2.5 KB, 1 views)
File Type: html MainLayout.html (4.8 KB, 1 views)
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Feb 28th, 2008, 16:14
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,408
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

Also, might not make a difference, but:
Code: Select all
 var sfEls = document.getElementById("MainNav").getElementsByTagName("LI");
You are using 'LI' when in your actual code you use 'li'. It might not make a difference but worth changing?
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Feb 28th, 2008, 16:42
Aso's Avatar
Aso Aso is offline
Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,341
Blog Entries: 2
Thanks: 11
Thanked 49 Times in 46 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

Nah, Jack, I read through the documentation. It's definitely meant to be caps

The Javascript isn't the problem here (the script is only to fix :hover pseduo on elements other than a in IE6).

Something to do with the CSS but I can't seem to see what!
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)

Last edited by Aso; Feb 28th, 2008 at 16:44.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Feb 28th, 2008, 21:37
Junior Member
Join Date: Jan 2008
Location: Melbourne
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

Excellent. The site is definitely starting to look more how it should.
Thanks for all the help Aso.

One quick question for anyone. I want to put rounded corners onto the 4 edges of the top menus. I've got the graphics done but I noticed that when I place the graphic in the html directly it stuffs with the alignment of the text. I figured I could get around it by creating new divs and placing the images as background objects. Is this a good way to go about it or is there something I can do that will result in less superfluous code?

Last edited by Itsumishi; Feb 28th, 2008 at 21:37. Reason: Typo!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Mar 4th, 2008, 04:57
Junior Member
Join Date: Jan 2008
Location: Melbourne
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Drop down menu alignment problems. Div wont vertically align.

Ok.

I've fiddled around with the design a fair bit and I have most things fixed.

However I've spent quite a few hours today trying to rectify the last few little issues and I just can't seem to get them sorted.

Firstly.
The page looks quite wrong in IE 6.

Secondly.
The page won't center in IE 7. (It does in IE 6!!!)

Thirdly.
There are a few minor allignment issues.
The Banner Image won't sit quite in the border. It also wont sit snug against the menus.
Also the main 'wrapperdiv' seems to want to be that itsy bit wider than the menu which looks a bit funny on the right edge.

Fourthly.
I've coded and re-coded then re-coded again and I just can't get the Son of SuckerFish menu to work right. Each time I do it the problems seem a bit different but I don't know why or how.

Links to page are

http://www.tourismaccreditationvic.c...ainLayout.html

http://www.tourismaccreditationvic.c...css/Styles.css

Any help would be great!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Positioning problems with horizontal drop down menu dreamabstract Web Page Design 2 Jun 16th, 2008 12:09
Having problems with a drop down menu eminee JavaScript Forum 7 Jan 8th, 2008 17:29
Align text vertically in a box josoap Web Page Design 3 Jul 12th, 2007 17:29
cell won't align to top vertically CSpoon Web Page Design 12 Oct 4th, 2006 00:22
Drop down menu problems matelo JavaScript Forum 0 Jan 16th, 2006 16:48


All times are GMT. The time now is 03:29.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

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