CSS - Navigation Bar Question
Hello, im just new in CSS
I've been wondering how did facebook did the navigation bar there.. the address bar (or maybe bookmarks bar) is really close to facebook's navigation bar and the navigation follows as I scroll can you please explain to me how did they do that? I want to do it on my site too... thank you! Similar TutorialsHi All, I am building a site that has the following structure for the navigation; Code: <div id="navigation"> <ul id="navlist"> <li class="home"><a href="../index.asp" title="home"><span>home</span></a></li> <li class="aboutus"><a href="../aboutus.htm" title="aboout us"><span>about us</span></a></li> <li class="ourservices"><a href="../ourservices.htm" title="our services"><span>our services</span></a> <ul> <li class="internationalmail"><a href="ourservices_internationalmail.htm" title="international mail"><span>international mail</span></a></li> <li class="worldwidecourier"><a href="ourservices_worldwidecourier.htm" title="worldwide courier"><span>worldwide courier</span></a></li> <li class="worldwidefreight"><a href="ourservices_worldwidefreight.htm" title="worldwide freight"><span>worldwide freight</span></a></li> <li class="storage"><a href="ourservices_storage.htm" title="storage"><span>storage</span></a></li> <li class="publishingservices"><a href="ourservices_publishingservices.htm" title="publishing services"><span>publishing services</span></a></li> </ul> </li> <li class="requestquote"><a href="../requestquote.htm" title="request a quote"><span>request a quote</span></a></li> <li class="contactus"><a href="../contactus.htm" title="contact us"><span>contact us</span></a></li> </ul> </div> The main LI is horizontal, and the containing UL, LI is a vertical dropdown. The seperate CSS file does the image replacements on the <a> and hides the text within the <span>, usual stuff. The nav works great, with the graphic rollovers etc. The rollover, again, standard way of doing it, background: url(<FILE>) no-repeat top left; and the a:hover rollover is a background: bottom left;. Edit: Just noticed that I can't link to the full site that I have uploaded for preview. What I want to do, is when the user roll's over any of the items within the sub-navigation, it keeps the main Services navigation link rolled over also. The only way I could think of doing this, and relatively simply, would be to use JavaScript, but wanted to explore any other CSS ways of doing this. For example, is it possible to change a style of another class, from another? Your help would be much appreciated! Hey guys I am currently having an issue with a CSS Navigation. I was wondering if anyone was available to help me out. http://schoolwide.sgajewski.com/menu/ I am currently having an issue with IE 7. It seems to be working in every other browser but the second level of the navigation is offset lower in IE7. The spacing starts off 1 pixel two low and progressively the gap gets wider. Code: ul.vertical, ul.vertical li { margin:0; padding:0; list-style-type:none; font-size:100%; } ul.vertical { position:absolute; z-index:1000; cursor:default; width:180px; left:1em; top:4.05em; } ul.vertical li { position:relative; text-align:left; cursor:pointer; cursor:hand; width:180px; margin:-1px 0 0 0; padding-bottom:0px!important; padding-bottom:1px; float:left; clear:both; top:0; left:0; } ul.vertical ul { z-index:1020; cursor:default; position:absolute; width:197px; margin:0 0 0 179px; top:-100em; left:-1px; padding:1px 0 0 0; height:0px; overflow:hidden; } ul.vertical ul li { width:197px; } ul.vertical ul ul { margin: 0 0 0 179px; } @media Screen, Projection { ul.vertical li:hover > ul { top:0; height:auto; overflow:visible; } } ul.vertical a, ul.vertical a:visited { display:block; cursor:pointer; cursor:hand; background:url(images/bg.jpg); padding:5px 7px; font:normal normal bold 0.7em tahoma, verdana, sans-serif; color:#008000; text-decoration:none; letter-spacing:1px; } ul.vertical a:hover, ul.vertical a:focus, ul.vertical a.rollover, ul.vertical a.rollover:visited { background:url(images/bg_over.jpg); color:#806020; } ul.vertical .outtop {background:url(images/bg_over_top.jpg);} ul.vertical .outbg {background:url(images/bg_over_mid.jpg);} ul.vertical .outbot {background:url(images/bg_over_bot.jpg);} ul.vertical ul a, ul.vertical ul a:hover, ul.vertical ul a:visited, ul.vertical ul a:active ul.vertical ul a:hover, ul.vertical ul a:focus, ul.vertical ul a.rollover, ul.vertical ul a.rollover:visited { background-image:none; } @media screen, projection { * html ul.vertical li { display:inline; f\loat:left; background:#ffffff; } } * html ul.vertical li { position:static; } * html ul.vertical a { position:relative; } ul[class^="vertical"] ul { display:none; } ul[class^="vertical"] ul { displa\y:block; } Any help on why this is offset in IE7 would be great. Thanks in advance. I'm pretty new to CSS, but I've managed to put together a website based from a psd, that validates and everything has gone well. My menu, however, is pretty shoddy. I have everything positioned the way I want it, but what I want to do is convert the lists inside from dropping down to being horizontal parallell to the nav bar itself. From: --- --- --- --- | | To: _ _ _ --- --- --- --- The site is here. Ignore the issues with the absolute positioning; its because of the ads at the top, and it doesn't affect the nav bar. I am desperatefor some help, it is ridiculous to figure out. Anyone who can help me, I would be crazy grateful. Thanks, Tom Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style type="text/css"> /*BEGINNING OF CSS*/ body{ padding: 0px; background-color: #000000; font-family: Verdana; color: #FFFFFF; text-align: center; } div.container { margin: 0 auto; padding: 0px; width: 1024px; text-align: left; } div.left { float: left; } div.right { float: right; } div.logo { margin: 0 auto; background-position: top center; text-align: center; } div.header { text-align: center; padding-top: 0px; } div.navigation { background-color: #000000; background-image: url(http://i39.tinypic.com/igm16v.jpg); overflow: auto; } div.content { background-color: #000000; background-image: url(http://i39.tinypic.com/2ce2qus.jpg); overflow: auto; height: 525px; margin: 0 auto; } div.footer { background-color: transparent; background-image: url(http://i39.tinypic.com/2vjsbrp.jpg); overflow: auto; height: 290px; padding: 0px; margin: 0 auto; } p.head { text-align: left; font-size: 24px; } p.content { position: relative; font-size: 12px; } a.main { text-decoration: none; font-size: 18px; padding: 8px; color: #FFFFFF; background-color: transparent; } a.sub { font-size: 16px; line-height: 150%; text-align: left; text-decoration: none; color: #999999; background-color: transparent; } a.plain { text-decoration: none; font-size: 12px; color: #FFFFFF; background-color: transparent; } a.plainfoot { text-decoration: none; font-size: 12px; color: #959595; opacity: 90%; background-color: transparent; border-bottom: 1px solid #0d0f10; opacity: 100%; } #nav, #nav ul { margin: 0 auto; padding: 0px; list-style: none; } #nav a.main { display: block; margin-left: 5px; } #nav a.sub { display: block; width: 150px; margin-left: 5px; } #nav li { float: left; width: 5em; } #nav li ul { position: absolute; width: 1em; left: -999em; } #nav li:hover ul { left: auto; } #nav li ul { position: absolute; padding: 7px; width: 1em; left: -999em; } #nav li:hover ul { left: auto; } #nav li:hover ul, #nav li.sfhover ul { left: auto; font-family: lucida grand; } h1.footer { position: relative; font-size: 18px; color: #123712; margin-bottom: 0%; margin-left: 50px; } p.footer { font-size: 12px; color: #909090; margin-left: 50px; max-width: 200px; text-decoration: none; } h1.main { font-size: 28px; font-weight: 200; margin-left: 140px; padding: 0; text-shadow: #959595; } p.content { font-size: 12px; color: #FFFFFF; line-height: 130%; margin-left: 140px; max-width: 450px; text-decoration: none; } div.date { background-color: transparent; background-image: url(http://i39.tinypic.com/xnc3de.jpg); background-repeat: no-repeat; padding: 0px; margin-top: 17px; margin-left: 0px; } h1.main2 { font-size: 28px; font-weight: 200; margin-left: 140px; text-shadow: #959595; } p.content2 { font-size: 12px; line-height: 130%; margin-left: 140px; max-width: 450px; text-decoration: none; } div.date2 { background-color: transparent; background-image: url(http://i39.tinypic.com/xnc3de.jpg); background-repeat: no-repeat; padding: 0px; min-height: 100px; margin: 0px; } div.sidebar { background-color: transparent; background-image: url(http://i41.tinypic.com/2r76kpu.jpg); background-repeat: no-repeat; background-position: top right; padding: 0px; min-height: 200px; margin-top: 15px; margin-right: 15px; } div.datetext1 { position: absolute; background: transparent; font-family: verdana, sans-serif; font-size: 12px; font-weight: 200; color: #FFFFFF; left: auto; top: 382px; padding-top: 262px; padding-left: 44px; } div.dateid1 { position: absolute; background: transparent; font-family: verdana, sans-serif; font-size: 24px; font-weight: 300; color: #123712; left: auto; top: 382px; padding-top: 281px; padding-left: 47px; } div.datetext2 { position: absolute; background: transparent; font-family: verdana, sans-serif; font-size: 12px; font-weight: 200; color: #FFFFFF; left: auto; top: 382px; padding-top: 44px; padding-left: 44px; } div.dateid2 { position: absolute; background: transparent; font-family: verdana, sans-serif; font-size: 24px; font-weight: 300; color: #123712; left: auto; top: 382px; padding-top: 63px; padding-left: 47px; } div.sidebarhead { position: absolute; background: transparent; font-family: verdana, sans-serif; font-size: 18px; font-weight: 200; color: #123712; text-align: center; left: auto; top: 400px; padding-top: 15px; padding-left: 630px; } div.sidebartext { position: absolute; background: transparent; font-family: verdana, sans-serif; font-size: 10px; color: #FFFFFF; line-height: 130%; text-align: left; max-width: 168px; left: auto; top: 400px; padding-top: 50px; padding-left: 610px; } /*END OF CSS*/ </style> <script type="text/javascript"> sfHover = function() { var sfEls = document.getElementById("nav").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); </script> <title>Obsidian Recording Front Page</title> </head> <body> <div class="container"> <div class="left"> <img src="http://i39.tinypic.com/14j6nsz.jpg" alt="left column"/> </div> <div class="right"> <img src="http://i40.tinypic.com/b4yir5.jpg" alt="right column"/> </div> <div class="logo"> <img src="http://i40.tinypic.com/2u77lua.jpg" alt="logo"/> </div> <div class="header"> <img src="http://i41.tinypic.com/1178qo6.jpg" alt="header"/> </div> <div class="navigation"> <ul id="nav"> <li><a class="main" href="http://www.obsidianrecording.com">Home</a></li> <li><a class="main" href="#">Music</a> <ul> <li><a class="sub" href="http://www.obsidianrecording.com/featured">Featured</a></li> <li><a class="sub" href="http://www.obsidianrecording.com/artists">Artists</a></li> <li><a class="sub" href="http://www.obsidianrecording.com/artists/thisisthefall">My Band</a></li> </ul> </li> <li><a class="main" href="http://www.obsidianrecording.com/design">Design</a></li> <li><a class="main" href="#">Store</a> <ul> <li><a class="sub" href="http://www.obsidianrecording.com/store/recording">Recording</a></li> <li><a class="sub" href="http://www.obsidianrecording.com/store/design">Design</a></li> <li><a class="sub" href="http://www.obsidianrecording.com/store/music">Music</a></li> </ul> </li> <li><a class="main" href="#">About</a> <ul> <li><a class="sub" href="http://www.obsidianrecording.com/about/rates">The Rates</a></li> <li><a class="sub" href="http://www.obsidianrecording.com/about/studio">The Studio</a></li> <li><a class="sub" href="http://www.obsidianrecording.com/about/tomhoneyman">Tom Honeyman</a></li> </ul> </li> </ul> </div> <div class="content" <div class="date"> <div class="sidebar" <h1 class="main">Cast into Shadows</h1> <p class="content">The first band ever to record at Obsidian Recording was Cast into Shadows. I'd like to shout out to Donnie, Evan, Josh, Brian, and J.T. for being the first group to come through here and for making a kickass record along the way. You can find more about them in the Artists section of the site.</p> </div> </div> <div class="date2"> <h1 class="main2">Website Launched!</h1> <p class="content2">After a looong time working on this site, I've finally finished just in time for summer! What you can expect is a lot of updates on what artists who record here are doing, free downloads, cool videos of their shows, special rates just for people who visit the site, and more. If you'd like to contact me, all my information and more is in the About section of the site. <br /><br /> Thanks for visiting, and I hope you enjoy!</p> </div> <div class="datetext1">Jun</div> <div class="dateid1">1</div> <div class="datetext2">Jun</div> <div class="dateid2">7</div> <div class="sidebarhead">New Website!</div> <div class="sidebartext">Welcome to the all-new Obsidian Recording site! I will regularly update with news, special rates, videos, featured free downloads, and more.</div> </div> <div class="footer"> <br /><br /><br /> <h1 class="footer">Recent Projects</h1> <p class="footer"><a class="plainfoot" href="www.obsidianrecording.com/artists/castintoshadows">Cast into Shadows</a><br /><br /><a class="plainfoot" href="http://www.obsidianrecording.com/artists/thisisthefall">This is the Fall</a></p> </div> </div> </body> </html> Hello, I'm new to the forum and not very good with CSS yet. I'm slowly moving from tables to CSS. I set up a sample page to describe the problem I'm having but the forum won't allow me to post the URL here. I have a vertical CSS "LI" navigation section in the left hand sidebar of this web page and it works perfectly in every Mac browser I try it on (very latest Mac versions of Opera, Firefox, Safari, Chrome, Camino, Omniweb, etc.). There's a white, 1-pixel horizontal spacer/separator line between each link in the left sidebar which is supposed to be 220 pixels wide. It is 220 pixels wide on all the Mac browsers I try it on but for some reason, as soon as I try the web page in IE 7 or IE 8, the white horizontal 1-pixel divider line is shorter and ends up being only 195 pixels wide and throws the whole, nice and "even" look off. I don't understand where the 25 pixels are disappearing to in IE 7 and IE 8. Can anyone offer any insight as to what the fix may be or what I've done wrong? Below is the code I've used to create the navigation. Thanks so much. HTML Code: Code: <div id="navcontainer"> <ul id="navlist"> <li id="active"><a href="#" id="current">Home</A></li> <li><a href="#">On To Page 2</A></li> <li><a href="#">On To Page 3</A></li> <li><a href="#">On To Page 4</A></li> <li><a href="#">On To Page 5</A></li> </ul> </div> CSS Code: Code: #navlist { padding-left: 25px; margin-left: 0; width: 220px; } #navlist li { list-style: none; margin: 0; padding: 0.25em; border-top: 1px solid white; } #navlist li a { background: transparent url(../images/list_off.gif) left center no-repeat; padding-left: 15px; text-align: left; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 12px; font-weight: bold; color: #277eb1; text-decoration: none; line-height: 30px; } #navcontainer ul li a:hover { background: transparent url(../images/list_on.gif) left center no-repeat; color: #da251c; } #navcontainer ul li a#current { background: transparent url(../images/list_active.gif) left center no-repeat; color: #999999; } hi, i was wondering if anyone knw any links to ultra super dooper cool websites for css navigations. I want to learn how to do ace ones. I have already googleed about, I found the sliding doors on ALA an stuff but i need that little bit more cool tutorials prefrably!! I did find one cool one athttp://www.bulkherbstore.com/ thanks tom. I have a nice little vertical navigation block that I would like to use in multiple pages within the same website. I would like to use the nav block without repeating the code, but I can't figure out how to do it. I have put the code in navigation.htm. What do I do next? How is this navigation done on the top of the page? I looked at the CSS and all the javascript. I can't see how the drop down is created? I tried to replicate it and copied the background images. I can get the menu to show and rollovers work. Just the drop down won't work. http://jmadvertising.com/ Hello. So I'm trying to make my html more semantic, so I'm trying to avoid divs and spans as much as possible. I'm trying to make an unordered list navigation, but it shows up really choppy in IE7. However, the moment I change it from <ul id="navigation"> to <div id="navigation">, it works perfectly. Just for semantics sake I'd like to see if I could keep the ul working. Here's the html code, it validates xhtml strict so you don't have to worry about that. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="css/global.css" rel="stylesheet" type="text/css" /> <title>Eagle Steel Buildings</title> </head> <body> <div id="wrapper"> <img id="banner" src="images/global/banner.jpg" alt="Eagle Steel Building"/> <ul id="navigation"> <li><a href="" class="selected">Home</a></li> <li><a href="">About Us</a></li> <li><a href="">Our Work</a></li> <li><a href="">Free Quote</a></li> <li><a href="">Contact Us</a></li> </ul> <h1>Steel Building Construction</h1> <h2>Lorem Ipsum</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut ultrices tortor. In lectus turpis, porta in mollis et, feugiat ac ligula. Vivamus arcu mauris, accumsan id mollis eu, blandit sed odio. Donec id magna nec quam aliquam scelerisque quis in metus. Ut pharetra lorem nec neque condimentum at viverra leo euismod. Fusce vitae orci sed enim bibendum viverra sodales id elit. Fusce lectus purus, rutrum rhoncus consequat non, porta et nisi. Proin vitae est odio. Donec erat orci, mollis id viverra condimentum, feugiat nec est.</p> <h2>Lorem Ipsum</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut ultrices tortor. In lectus turpis, porta in mollis et, feugiat ac ligula. Vivamus arcu mauris, accumsan id mollis eu, blandit sed odio. Donec id magna nec quam aliquam scelerisque quis in metus. Ut pharetra lorem nec neque condimentum at viverra leo euismod. Fusce vitae orci sed enim bibendum viverra sodales id elit. Fusce lectus purus, rutrum rhoncus consequat non, porta et nisi. Proin vitae est odio. Donec erat orci, mollis id viverra condimentum, feugiat nec est.</p> <h2>Lorem Ipsum</h2> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ut ultrices tortor. In lectus turpis, porta in mollis et, feugiat ac ligula. Vivamus arcu mauris, accumsan id mollis eu, blandit sed odio. Donec id magna nec quam aliquam scelerisque quis in metus. Ut pharetra lorem nec neque condimentum at viverra leo euismod. Fusce vitae orci sed enim bibendum viverra sodales id elit. Fusce lectus purus, rutrum rhoncus consequat non, porta et nisi. Proin vitae est odio. Donec erat orci, mollis id viverra condimentum, feugiat nec est.</p> <form id="quoteform" action="quote_home.php" method="post"> <fieldset> <label for="name">Name</label><input type="text" name="name" id="name" /> <label for="date">Date</label><input type="text" name="date" id="date" /> <label for="phone">Phone</label><input type="text" name="phone" id="phone" /> <label for="email">Email</label><input type="text" name="email" id="email" /> <label for="location_zip_code">Location Zip Code</label><input type="text" name="location_zip_code" id="location_zip_code" /> <label for="width">Width</label><input type="text" name="width" id="width" /> <label for="length">Length</label><input type="text" name="length" id="length" /> <label for="sidewall_height">Sidewall Height</label><input type="text" name="sidewall_height" id="sidewall_height" /> </fieldset> </form> </div> </body> </html> And here's the CSS, also validated. Code: /* http://meyerweb.com/eric/tools/css/reset/ */ /* v1.0 | 20080212 */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, textarea dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; } body { line-height: 1; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } /* remember to define focus styles! */ :focus { outline: 0; } /* remember to highlight inserts somehow! */ ins { text-decoration: none; } del { text-decoration: line-through; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: collapse; border-spacing: 0; } /* Begin Page Styles */ .btest{border:1px solid #FFFFFF;} body { background: #CCCCCC URL('../images/global/steelbg.jpg') top left; margin: 0px; padding: 0px;} #wrapper{ margin: 0px auto; width: 1010px; height: 1000px; background: URL('../images/global/wrappershadow.png') repeat-y;} #banner{ display: block; margin: 0px auto; width: 1000px; height: 250px; } #navigation{ display: block; margin: -2px auto 0px; width: 1000px; height: 38px; list-style-type:none; background: #000000 URL('../images/global/navbg.png') no-repeat;} #navigation a{ float: left; height: 39px; line-height: 2.3em; margin-top:3px; padding-left: 13px; padding-right: 13px; font-size: 1.0em; font-family: Verdana, serif; text-decoration: none; font-weight: bold; color: #CCCCCC; text-align: center;} #navigation a:hover, #navigation a.selected{ text-decoration: underline;} #navigation a.selected{ color: #ff0000;} I have not finished styling the rest of the page, I am only concerned with the navigation right now. I appreciate your time and effort! The Problem: I want my logo (a gif image) to justify to the left but padding centers it. Is there a way to NOT pad one "cell" in an inline navigation bar using css without affecting the rest which follow (which are padded)? Please email me for urls to see exactly what I'm working with. Many thanks in advance! Navigation buttons appear just fine with Firefox but they stand 2 pixels down of their original location when viewed with internet explorer. I assigned almost everything margin:0px but did not fix my problem. Click here to view. Red navigation bar.: http://www.refinethetaste.com/html/ Hi devshed, First post here so I hope someone wouldn't mind giving me some help with a layout problem I'm having which I think is probably CSS related. The navbar div should be at the top of the maincontent div and to the right of the sidebar div with no gaps. I can get the desired results in FF but in IE there is a whitespace gap between the top of maincontent and navbar divs. Unfortunately I don't have it online yet to show you because I need to upgrade my hosting package first. If anyone can spare a few minutes and make any suggestions I would be very grateful. Many Thanks Jez HTML: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Mseis</title> <link href="includes/layout.css" rel="stylesheet" type="text/css" /> <!--[if IE]> <style type="text/css"> /* place css fixes for all versions of IE in this conditional comment */ .twoColHybLtHdr #sidebar1 { padding-top: 30px; } .twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; } /* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */ </style> <![endif]--></head> <body class="twoColHybLtHdr"> <div id="container"> <div id="header"> <?php include("includes/header.php"); ?> <!-- end #header --></div> <div id="sidebar1" align="center"> <?php include("includes/menu.php"); ?> <!-- end #sidebar1 --> </div> <div id="mainContent"> <div id="navbar"> This is the navbar </div> <h1> Main Content </h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id, libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh. Donec nec libero.</p> <h2>H2 level heading </h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p> <!-- end #mainContent --></div> <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --> <br class="clearfloat" /> <div id="footer"> <?php include("includes/footer.php"); ?> <!-- end #footer --></div> <!-- end #container --></div> </body> </html> CSS: Code: @charset "utf-8"; body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #633C91; } .twoColHybLtHdr #container { width: 80%; /* this will create a container 80% of the browser width */ background: #FFFFFF; margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ min-width: 800px; } .twoColHybLtHdr #header { background: #DDDDDD; padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ } .twoColHybLtHdr #header h1 { margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ } /* Tips for sidebar1: 1. Since we are working in relative units, it's best not to use padding on the sidebar. It will be added to the overall width for standards compliant browsers creating an unknown actual width. 2. Since em units are used for the sidebar value, be aware that its width will vary with different default text sizes. 3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColHybLtHdr #sidebar1 p" rule. */ .twoColHybLtHdr #sidebar1 { float: left; width: 12em; /* since this element is floated, a width must be given */ background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 15px 0; /* top and bottom padding create visual space within this div */ } .twoColHybLtHdr #sidebar1 h3, .twoColHybLtHdr #sidebar1 p { margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */ margin-right: 10px; } /* Tips for mainContent: 1. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. 2. Be aware it is possible to cause float drop (the dropping of the non-floated mainContent area below the sidebar) if an element wider than it can contain is placed within the mainContent div. WIth a hybrid layout (percentage-based overall width with em-based sidebar), it may not be possible to calculate the exact width available. If the user's text size is larger than average, you will have a wider sidebar div and thus, less room in the mainContent div. You should be aware of this limitation - especially if the client is adding content with Contribute. 3. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This may help avoid several IE-specific bugs. */ .twoColHybLtHdr #mainContent { margin: 0 20px 0 13em; /* the right margin can be given in percentages or pixels. It creates the space down the right side of the page. */ } .twoColHybLtHdr #navbar { background: #AAAAAA; margin: 0px -20px 0 -20px; padding: 1px 20px 1px 20px; } .twoColHybLtHdr #navbar a a:link a:visited { color:#FF0000; text-decoration:none; font-size: small; } .twoColHybLtHdr #navbar a:hover a:active { color:#FF0000; text-decoration:underline; font-size: small; } .twoColHybLtHdr #footer { padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ background:#DDDDDD; } .twoColHybLtHdr #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ } /* Miscellaneous classes for reuse */ .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear: both; height: 0; font-size: 1px; line-height: 0px; } /* Custom CSS */ .msgreen { color: #BEDA57; } .msblue { color: #81C4E2; } .mspurple { color: #633C91; } .failed { color: #FF0000; } h1 { color: #BEDA57; } h2 { color: #81C4E2; } fieldset { margin: 1.5em 0 0 0; padding: 0; background-color: #81C4E2; } legend { margin-left: 1em; color: #633C91; font-weight: bold; } fieldset ol { padding: 1em 1em 0 1em; list-style: none; } fieldset li { padding-bottom: 1em; } fieldset.submit { border-style: none; background-color: transparent; } label { display: block; color: #633C91; } input.btn { border: 1px solid; background-color: #81C4E2; color: #633C91; font: bold 80%; } input.btnhov{ border-color: #FF0000; } if you look under the top banner on my site, the navigation bar is too tall and wide, and all of the buttons don't even fit the full width of the page. it is partially complicated because two of the ten buttons have drop-down menus created through javascript. it is a horizontal ul with the buttons floated left. i'll give you the cut-down html code and then the css to go along with it so you get the general idea. navigation menu html: html Code: Original - html Code <div id='navbar'> <ul id="sddm"> <?php echo " <li> <a href='".get_home_link()."'><img src='[themedir]images/home_icon.gif' alt=''>Home</a> </li> <li> <a href='".get_category_link("name=all&page=1")."'"; ?> onmouseover='mopen("m1")' <?php echo " onmouseout='mclosetime()'><img src='[themedir]images/allgames_icon.gif' alt=''>Games</a> <div id='m1' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'> "; $categories = get_categories("htmlize=true&order=order&sort=ASC&parent=Games"); foreach ($categories as $category) { $link=get_category_link("name="._sp($category['name'])."&page=1"); echo "<a href='".$link."'>".$category['name']; $category['gamenum'] = count(get_games("thecat="._sp($category['name']))); echo " (".$category['gamenum'].")"; echo "</a>"; } $link=get_category_link("name=Unvalidated&page=1"); $unvalidated_games=get_games("active=No"); $num_unvalidated=count($unvalidated_games); echo " <a href='".$link."'>Unvalidated (".$num_unvalidated.")</a> </div> </li> <li> <a href='".get_category_link("name=all&page=1&cattype=videos")."'"; ?> onmouseover='mopen("m2")' <?php echo " onmouseout='mclosetime()'><img src='[themedir]images/videos_icon.gif' alt=''>Videos</a> <div id='m2' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'> "; $categories = get_categories("htmlize=true&order=order&sort=ASC&parent=Videos"); foreach ($categories as $category) { $link=get_category_link("name="._sp($category['name'])."&page=1&cattype=videos"); echo "<a href='".$link."'>".$category['name']; $category['gamenum'] = count(get_games("cattype=videos&thecat="._sp($category['name']))); echo " (".$category['gamenum'].")"; echo "</a>"; } $link=get_category_link("name=Unvalidated&page=1&cattype=videos"); $unvalidated_games=get_games("active=No&cattype=videos"); $num_unvalidated=count($unvalidated_games); echo " <a href='".$link."'>Unvalidated (".$num_unvalidated.")</a> </div> </li> <li> <a href='".get_users_link()."'><img src='[themedir]images/members_icon.gif' alt=''>Members</a> </li> <li> <a href='".get_news_link()."'><img src='[themedir]images/news_icon.gif' alt=''>News</a> </li> <li> <a href='".get_submit_link()."'><img src='[themedir]images/request_icon.gif' alt=''>Submit</a> </li> <li> <a href='".get_links_link()."'><img src='[themedir]images/links_icon.gif' alt=''>Links</a> </li> <li> <a href='".get_rules_link()."'><img src='[themedir]images/rules_icon.gif' alt=''>Rules</a> </li> <li> <a href='".get_faq_link()."'><img src='[themedir]images/faq_icon.gif' alt=''>FAQ</a> </li> <li> <a href='".get_contact_link()."'><img src='[themedir]images/contact_icon.gif' alt=''>Contact</a> </li>"; ?> </ul> <div style="clear:both"></div> </div> <div id='navbar'> <ul id="sddm"> <?php echo " <li> <a href='".get_home_link()."'><img src='[themedir]images/home_icon.gif' alt=''>Home</a> </li> <li> <a href='".get_category_link("name=all&page=1")."'"; ?> onmouseover='mopen("m1")' <?php echo " onmouseout='mclosetime()'><img src='[themedir]images/allgames_icon.gif' alt=''>Games</a> <div id='m1' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'> "; $categories = get_categories("htmlize=true&order=order&sort=ASC&parent=Games"); foreach ($categories as $category) { $link=get_category_link("name="._sp($category['name'])."&page=1"); echo "<a href='".$link."'>".$category['name']; $category['gamenum'] = count(get_games("thecat="._sp($category['name']))); echo " (".$category['gamenum'].")"; echo "</a>"; } $link=get_category_link("name=Unvalidated&page=1"); $unvalidated_games=get_games("active=No"); $num_unvalidated=count($unvalidated_games); echo " <a href='".$link."'>Unvalidated (".$num_unvalidated.")</a> </div> </li> <li> <a href='".get_category_link("name=all&page=1&cattype=videos")."'"; ?> onmouseover='mopen("m2")' <?php echo " onmouseout='mclosetime()'><img src='[themedir]images/videos_icon.gif' alt=''>Videos</a> <div id='m2' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'> "; $categories = get_categories("htmlize=true&order=order&sort=ASC&parent=Videos"); foreach ($categories as $category) { $link=get_category_link("name="._sp($category['name'])."&page=1&cattype=videos"); echo "<a href='".$link."'>".$category['name']; $category['gamenum'] = count(get_games("cattype=videos&thecat="._sp($category['name']))); echo " (".$category['gamenum'].")"; echo "</a>"; } $link=get_category_link("name=Unvalidated&page=1&cattype=videos"); $unvalidated_games=get_games("active=No&cattype=videos"); $num_unvalidated=count($unvalidated_games); echo " <a href='".$link."'>Unvalidated (".$num_unvalidated.")</a> </div> </li> <li> <a href='".get_users_link()."'><img src='[themedir]images/members_icon.gif' alt=''>Members</a> </li> <li> <a href='".get_news_link()."'><img src='[themedir]images/news_icon.gif' alt=''>News</a> </li> <li> <a href='".get_submit_link()."'><img src='[themedir]images/request_icon.gif' alt=''>Submit</a> </li> <li> <a href='".get_links_link()."'><img src='[themedir]images/links_icon.gif' alt=''>Links</a> </li> <li> <a href='".get_rules_link()."'><img src='[themedir]images/rules_icon.gif' alt=''>Rules</a> </li> <li> <a href='".get_faq_link()."'><img src='[themedir]images/faq_icon.gif' alt=''>FAQ</a> </li> <li> <a href='".get_contact_link()."'><img src='[themedir]images/contact_icon.gif' alt=''>Contact</a> </li>"; ?> </ul> <div style="clear:both"></div> </div> navigation menu general css: css Code: Original - css Code #sddm { display:block; margin: 0; padding: 0; z-index: 30; position:absolute; } #sddm li { display:block; margin: 0; padding: 0; list-style: none; float: left; max-height:31px; } #sddm li a { display: inline-block; text-decoration: none; color:#495B20; background-color:#BAD36B; border-left: 2px solid #fff; border-top: 2px solid #fff; border-right: 2px solid #000; border-bottom: 2px solid #000; padding: 4px 0.3em; margin:0; } #sddm { so what i want is for the buttons (<li>s) to have the exact height of their background div, which is 31px, and i also want them to fill 100% of their background div's width. how can i make this possible? I'm editing a CSS drop down navigation that uses <ul> and <li>. Is there a way to change the background color & rollover in just one of the dropdowns? The code is below in two sections. I've highlighted the list that I'd like to change the background color of. Thanks for your help! Code: <div id="wrap"> <ul id="navbar"> <!-- The strange spacing herein prevents an IE6 whitespace bug. --> <li><a href="#"><IMG SRC="d_images/navigation_01.gif" border="0"></a> </li> <li><a href="#"><IMG SRC="d_images/navigation_02.gif" border="0"></a> <ul> <li><a href="summit_09registration.cfm">Register</a></li><li> <a href="summit_09scholarship.cfm">Scholarships</a></li></ul> <li><a href="#"><IMG SRC="d_images/navigation_03.gif" border="0"></a> <ul> <li><a href="summit_09awards.cfm">Leadership Awards</a></li><li> <a href="summit_09party.cfm">Anniversary Party</a></li><li> <a href="summit_09work.cfm">Work Project</a></li><li> <a href="summit_09dine.cfm">Dine Arounds</a></li><li> <a href="summit_09jazz.cfm">Jazz Fesitval</a></li><li> <a href="summit_09networking.cfm">Networking</a></li></ul> </li> <li><a href="#"><IMG SRC="d_images/navigation_04.gif" border="0"></a> <ul> <li><a href="summit_09sponsors.cfm">Conference Sponsors</a></li><li> <li><a href="summit_09exhibit.cfm">Ad/Exhibit</a></li></ul> </li> <li><a href="#"><IMG SRC="d_images/navigation_05.gif" border="0"></a> <ul> <li><a href="summit_09sponsors.cfm">Conference Sponsors</a></li><li> <li><a href="summit_09exhibit.cfm">Ad/Exhibit</a></li></ul> </li> <li><a href="#"><IMG SRC="d_images/navigation_06.gif" border="0"></a> <ul> <li><a href="summit_09sponsors.cfm">Conference Sponsors</a></li><li> <li><a href="summit_09exhibit.cfm">Ad/Exhibit</a></li></ul> </li> <li><a href="#"><IMG SRC="d_images/navigation_07.gif" border="0"></a> <ul> <li><a href="summit_09hotel.cfm">Conference Hotel</a></li><li> <a href="summit_09travel.cfm">Travel</a></li><li> <a href="summit_09neworleans.cfm">New Orleans</a></li></ul> </li> </ul></div> Code: <style type="text/css"> #navbar { margin: 0; padding: 0; height: 0;} #navbar li { list-style: none; float: left; } #navbar li a { display: block; padding-bottom:0px; padding-left: 0px; padding-right:0px; padding-top:0px; border: 0px; color: #fff; font-family: helvetica; font-size: 8pt; font-style: bold; font-color: #ffffff; text-decoration: none;} #navbar li ul { display: none; width: 10em; /* Width to help Opera out */ background-image: url(../images/summit_nav_back.gif);} #navbar li:hover ul, #navbar li.hover ul { display: block; position: absolute; margin: 0; padding: 0; } #navbar li:hover li, #navbar li.hover li { float: none; } #navbar li:hover li a, #navbar li.hover li a { background-image: url(../images/summit_nav_back.gif); border-bottom: 1px solid #fff; color: #000; } #navbar li li a:hover { background-image: url(../images/summit_nav_red.gif); } </style> <script language="JavaScript"> <!-- function SymError() { return true; } window.onerror = SymError; var SymRealWinOpen = window.open; function SymWinOpen(url, name, attributes) { return (new Object()); } window.open = SymWinOpen; //--> </script> <script> // Javascript originally by Patrick Griffiths and Dan Webb. // http://htmldog.com/articles/suckerfish/dropdowns/ sfHover = function() { var sfEls = document.getElementById("navbar").getElementsByTagName("li"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" hover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" hover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); </script> I have a menu, click he http://progra.ro/demomenu/ This menu not appear correctly in Internet Explorer 6 due to "SPAN" element. Anyone know how to fix this problem leaving the span element intact in HTML ? All browser show the menu correctly, except IE6.Thanks! Hi all, I have a very simple question.. my mouseover is ALMOST working properly. However when you mouse over the box colour changes, but the text only changes when you are DIRECTLY over the text. How can I fix this? Check the communities drop down for an example of my problem. Here is my temp site URL: edit: I can't post links yet?!?! PM me for link Thanks! I have a navigation bar similar to the one on this site. I want whatever current button that is clicked on to be a different color just like the site I linked. I thought this was done using the a:active tag but it doesn't seem to be working. It quickly changes back to whatever the default a tag specifies. Is there a trick to this? Thanks in advance. hatchetradio.com/radio/ if you take a peek, you'll see the navigation is under the entire layout. I'm not quite sure why, any help? I have a navigation done in CSS. I would like to have each button of the navigation have a left AND right border. This is something I've growled about for a long time, because I can't figure out the best way to do it other than haveing an empty link at the end of the list. Here's what I currently have... Code: <div id="nav"> <ul> <li><a href="#" title="Link 1" >Link 1</a></li> <li><a href="#" title="Link 2" >Link 2</a></li> <li><a href="#" title="Link 3" class="active" >Link 3</a></li> <li><a href="#" title="Link 4" >Link 4</a></li> <li><a href="#" title="Link 5" class="navlast">Link 5</a></li> </ul> </div> The class="navlast" puts a right border on the last list item, so that they all have a left and right border. The CSS to present this is as follows... Code: #nav { width: 760px; float: left; border-top: solid 1px #A1A1C1; border-bottom: solid 1px #A1A1C1; background-image: url(../i/navbg.gif); background-repeat: repeat-x; margin: 0; padding: 0; } #nav ul { margin: 0 0 0 25px; padding: 0; list-style: none; } #nav ul li { float: left; margin: 0; } #nav ul li a:link, #nav ul li a:visited { display: block; padding: 4px 20px; color: #333; font-weight: bold; border-left: solid 1px #CCD0DF; text-decoration: none; } #nav ul li a:hover { text-decoration: none; background-color: #F7F9FA; color: #333; } #nav ul li a.navlast { border-right: solid 1px #CCD0DF; } #nav ul li a.active { text-decoration: none; background-color: #F7F9FA; color: #333; } The active class is set so that the page that is currently being looked at will be marked by that link looking like it's hovered state (in this case it's link 3). The only downfall to this is that the last list item can't have 2 classes, and to add the .active class styles to the .navlast list item will result in link 5 being highlighted all the time. I'm probably making this way too complicated, but is there anyone that might have a suggestion as to how I can get each link list item to have a border and still mark each page as being the one that is currently being viewed? Hey guys I have a page I am working on and I am running into a little problem. I created a navigation bar using css and now I want to link up the navigation bar. The problem is when I link it it turns it to a blue hyperlink. I know I can change the css to get rid of that, but I also want part of the page to look like and be set up like a regular blue hyperlink. How can I get around this. Here is the page I am working on (URL address blocked: See forum rules) I want the positive and negative tests to be normal hyperlinks but I want the nav bar to stay in the css I set up thanks for the help Sean |