Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-28-2010, 05:51 PM   PM User | #1
nickHiebert
Regular Coder

 
Join Date: Oct 2009
Location: London, ON
Posts: 111
Thanks: 4
Thanked 0 Times in 0 Posts
nickHiebert is an unknown quantity at this point
Problem with alignment on #navbar

The site: http://bit.ly/dnzFFe (Just used bit.ly so Google doesn't pick up the name) (Firefox Only)

If you look at the navigation across the top it's not aligned properly.

I want to center them so they align properly.

Home - #navbar ul li#activenav

About - ul#aboutnav

Class Info - ul#classnav

A Typical Lesson - ul#agegrpnav

Studio Location, Music Downloads and Contact - #navbar li.mainnav

I'm not worrying about the drop down menus quite yet. Once there aligned probably I'll deal with them.

Help will be appreciated
nickHiebert is offline   Reply With Quote
Old 06-28-2010, 06:00 PM   PM User | #2
skywalker2208
Regular Coder

 
Join Date: Jan 2009
Posts: 193
Thanks: 0
Thanked 20 Times in 20 Posts
skywalker2208 is an unknown quantity at this point
You need to put the list tags around your sub unordered list tags. Plus you are missing the starting list tags for your sub unordered list tags. I marked the closing tags in red.
Code:
<div id="navbar">
    	<ul>
			<li id="activenav"><a href="#">Home</a></li>

            <ul id="aboutnav"><a href="#">About</a></li>
                	<li class="aboutnavitem"><a href="/the-teacher.html">The Teacher</a></li>
                    <li class="aboutnavitem"><a href="/goal-of-early-childhood-music.html">Goal of Early Childhood Music</a></li>
            </ul>
                
            <ul id="classnav"><a href="#">Class Info</a></li>
                    <li class="classnavitem"><a href="/take-home-materials.html">Take Home Materials</a></li>

                    <li class="classnavitem"><a href="/class-times-and-fees.html">Class Times & Fees</a></li>
            </ul>
                
            <ul id="agegrpnav"><a href="#">A Typical Lesson</a></li>
                        	<li class="agegrpitem"><a href="/a-typical-lesson-birth-to-age-4.html">Birth to Age 4</a></li>
                            <li class="agegrpitem"><a href="/a-typical-lesson-jk-sk-grade-1.html">JK/SK/Grade 1</a></li>
            </ul>

            
            <li class="mainnav"><a href="/studio-location.html">Studio Location</a></li>
            <li class="mainnav"><a href="/music-downloads.html">Music Downloads</a></li>
            <li class="mainnav"><a href="/contact.php">Contact</a></li>
         </ul>
	</div><!-- end navbar-->
skywalker2208 is offline   Reply With Quote
Old 06-28-2010, 08:03 PM   PM User | #3
SB65
Senior Coder

 
Join Date: Feb 2009
Location: West Yorkshire
Posts: 2,827
Thanks: 9
Thanked 685 Times in 679 Posts
SB65 will become famous soon enoughSB65 will become famous soon enough
Are you trying to centre the links on your top nav? If so you need to apply text-align:center to #navbar ul. It loks wrong at the moment because of the second level menu under Home.
SB65 is offline   Reply With Quote
Old 06-29-2010, 01:43 PM   PM User | #4
Rowsdower!
Senior Coder

 
Rowsdower!'s Avatar
 
Join Date: Oct 2008
Location: Some say it's everything.
Posts: 2,015
Thanks: 5
Thanked 395 Times in 388 Posts
Rowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura about
The general "rule of thumb" for CSS debugging is to make sure your HTML is fully validated first. If your HTML is invalid there can be any number of unexpected results for the CSS.

Check out the W3.org validator.

You currently have 19 errors and 1 warning.

Enabling the "verbose output" option gives you a few hints at how to fix the errors and warnings you see.

Once that is sorted out the CSS debugging can resume.
__________________
The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
See Mediocrity in its Infancy
It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
Seek and you shall find... basically:
validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting
Rowsdower! is offline   Reply With Quote
Old 07-04-2010, 12:19 AM   PM User | #5
nickHiebert
Regular Coder

 
Join Date: Oct 2009
Location: London, ON
Posts: 111
Thanks: 4
Thanked 0 Times in 0 Posts
nickHiebert is an unknown quantity at this point
It's now Valid. Now I have no idea how to make it display across the navbar. I know if you do height: 20px; and line-height: 20px and the navbar is 20px in height it should automatically center and put all the items there.

Please Help.

Code:
<div id="navbar">
    	<ul>
		        <li id="homenav"><a href="#">Home</a></li>
                        <li><a href="#" onmouseover="mopen('aboutnav')" onmouseout="mclosetime()">About</a>
            	           <div id="aboutnav" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
                		<a href="/the-teacher.html">The Teacher</a>
                                <a href="/goal-of-early-childhood-music.html">Goal</a>
                            </div>
                        </li>   
            <li><a href="#" onmouseover="mopen('classnav')" onmouseout="mclosetime()">Class Info</a>
            	<div id="classnav" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> 
						<a href="/take-home-materials.html">Take Home Materials</a>
                    	<a href="/class-times-and-fees.html">Class Times and Fees</a>
                </div>
   			</li>
            <li><a href="#" onmouseover="mopen('agegrpnav')" onmouseout="mclosetime()">A Typical Lesson</a>
            	<div id="agegrpnav" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
                        <a href="/a-typical-lesson-birth-to-age-4.html">Birth to Age 4</a>
                        <a href="/a-typical-lesson-jk-sk-grade-1.html">JK/SK/Grade 1</a>
                </div>
            </li>          
            <li><a href="#" onmouseover="mopen('medianav')" onmouseout="mclosetime()">Media</a>
            	<div id="medianav" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> 
                		<a href="/pictures.html">Pictures</a>
                    	<a href="/music-downloads.html">Music Downloads</a>
                </div>   	
             </li>   
           	<li class="locationnav"><a href="/studio-location.html">Studio Location</a></li>
            <li class="contactnav"><a href="/contact.php">Contact</a></li>
         </ul>
</div><!-- end navbar-->

Last edited by nickHiebert; 07-04-2010 at 12:23 AM.. Reason: EDIT: navbar code
nickHiebert is offline   Reply With Quote
Reply

Bookmarks

Tags
#navbar li.activenav, alignment, list item, navigation, unordered list

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:09 AM.


Advertisement
Log in to turn off these ads.