Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Location
    London, ON
    Posts
    112
    Thanks
    4
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Jan 2009
    Posts
    193
    Thanks
    0
    Thanked 20 Times in 20 Posts
    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-->

  • #3
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,950
    Thanks
    9
    Thanked 724 Times in 718 Posts
    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.

  • #4
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    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

  • #5
    Regular Coder
    Join Date
    Oct 2009
    Location
    London, ON
    Posts
    112
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •