CSS - Css- Vertical Navbar Issue
Hi all,
I'm pretty new to CSS and html, and I've run into a problem with a navbar I've created for a website. I want the navbar to extend the length of the content on each page, but I can't seem to set it for that. All I've been able to do so far is get it to fit the content of the navbar itself (too small), or set the height for a higher number of pixels than I need on most of the pages. This lets me accommodate the content on my lengthiest page, but it leaves the others with a lot of white space on the screen. Could someone please take a look at the code and help me? Bolded line is the problem, but setting it to a percentage doesn't work, either. Thank you for answering what's probably painfully obvious!: #navigation { background: #CCCCCC; float: left; width: 18%; height: 750px; border-right: #990033 2px solid; border-left: #990033 2px solid; font-family: arial, sans-serif; line-height: 150%; background-image: url (navbar.jpg); background-repeat: repeat-y; } #navigation ul{ list-style: none; background-color: #CCCCCC; padding: 5px; margin: 0px; text-align: left; } #navigation li a { display: block; color: #000000; text-decoration: none; Similar TutorialsHi guys I'm having trouble trying to convert a CSS navbar, which renders vertically, into an horizontal navbar. Look, here is the HTML Code, and following, the CSS code Code: <div id="menutoolbar"> <ul> <li><a href="link1.html">Opcion1</a></li> <li><a href="link2.html">Opcion2</a></li> <li><a href="link3.html">Opcion3</a></li> </ul> </div> The CSS Code Code: div#menutoolbar { height: auto; width: auto; } div#menutoolbar li { height: 21px; width: 32px; margin: 0px; font-family: Tahoma; font-size: small; text-align: center; line-height: 65px; list-style-type: none; background-image: url(http://alf.openu.ac.il/www_eng/icon/button.gif); background-position: center top; background-repeat: no-repeat; } div#menutoolbar li a { font-weight: bold; display: block; width: 100%; height: 100%; text-decoration: none; } div#menutoolbar li a:link { color: blue: } div#menutoolbar li a:visited { color: #900; } div#menutoolbar li a:hover { font-weight: bold; color: red; } div#menutoolbar li a:active { color: black; } Does any1 know which code I have to modify to transform this vertical toolbar into horizontal ? Or maybe to point me to an easy example for doing an horizontal set of css buttons like this example... Thanks... my navbar is a <ul> and i jsut added image icons. i have two problems, the placement and the vertical centering. placement: well, i guess its best to show you the code and what i had to do to get it in place. i used position:relative and then changed the bottom, but why is it so obscure??? Code: #navbar { text-align:right; background-image: url('images/menu_new.GIF'); background-repeat:repeat-x; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; padding-right: 8px; margin-top:-12; height:31; } #navbar ul { margin-right: -0.3em; height:31px; position:relative; bottom:-2px; } #navbar ul li { display: inline; list-style-type:none; margin-left: 0.3em; margin-right: 0.3em; position:relative; vertical-align:middle; } #navbar ul li a { padding-top:11px; 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; } #navbar ul li a:hover { background-color:#495B20; color:#BAD36B; border-left: 2px solid #000; border-top: 2px solid #000; border-right: 2px solid #fff; border-bottom: 2px solid #fff; } #navbar ul li div { position:relative; } #navbar ul li img { border:none; width:24px; height:24px; padding-right:4px; margin: 0; } vertical centering: i have looked at the tutorial, but i need serious help. i'm not trying it again, im missing something. can someone please show me how do do this? i want to center it like this... ....................................... . . . texttexttexttexttext. .image texttexttexttexttext. .----- texttexttexttexttext. . . ....................................... so both the image and text are centered but theyre floated left. actually, maybe they dont need to be floated cuz its just a word or two. look at the header for the best desc. i have tried this with my game box, and i'm clued out. i really hope sum1 can help me with this. http://www.viportals.com/ EDIT: DID IT ON MY OWN!!! THATS A FIRST!!! Code: #navbar { text-align:center; background-image: url('images/menu_new.GIF'); background-repeat:repeat-x; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 14px; margin-top:-15px; height:31px; line-height:31px; margin-left:0; margin-right:0; } #navbar ul li { display: inline; list-style-type:none; } #navbar ul li a { padding-left: 0.3em; padding-right: 0.3em; padding-top: 4px; padding-bottom: 4px; 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; } #navbar ul li a:hover { background-color:#495B20; color:#BAD36B; border-left: 2px solid #000; border-top: 2px solid #000; border-right: 2px solid #fff; border-bottom: 2px solid #fff; } #navbar ul li img { border:none; width:24px; height:24px; padding-right:4px; vertical-align: middle; } now i have one QUESTION: how do i get all the buttons to align center?????????? they all stay to the right oh, and not a huge deal, but the text is a couple pixels down so it brings the image down too. how can i make the text in the vertical middle? the line-height thing only worked so well. Greetings, I am attempting to increase the space between the navigation links listed on the left column of this index page. fop27.org/fopnet/FPT/ I have been trying add spacing between these flash images for hours to no avail. Ideally, I would like to add approx half inch of spacing between each image to balance out the page. I have minimal knowledge of css and would greatfully appreciate any assistance. All the Best! I am new to CSS style sheets and coding. Best way to explain problem is to say: go to: sfsmokefree.org/test View in Firefox = no issues, looks good View in I.E. = left column is all pushed downwards what's up with that? I'm attempting to vertically align my content to the size of the browser window, something that I've concluded can be done a million ways after days of Googling and reading. My outcome seems to work fine in all browsers (FF, Safari, Opera, Chrome, Navigator are the ones I've tested) except Internet Explorer. It renders perfect in IE 8, but there is a huge margin bumping the content down in all other versions of IE. The complete execution can be seen he http://www dot kristenshemanski dot com/testing/index dot html Any thoughts/input is welcome. I've completely hit a wall with this one. Also, I am indeed still using nested tables. I still have not completely mastered div tables, so I've decided to stick with the familiar until I learn a bit more. This project has really opened my eyes to how out-dated my coding is. Here is my CSS for the vertical positoning: Code: /* Divs */ #outer { position: absolute; height: 100%; width: 100%; border:0; overflow: visible; vertical-align: middle; } #inner { position: relative; top: 50%; height: 645px; width: 100%; margin: 0px auto; } Hi, I am having trouble with divs inside tables cells. I have td's in a row, and I want all the objects within these cells to be aligned at the top of the cells. However, the objects within the cells with lesser content are vertically aligning to the central level of the cell with the most content. Please check: www dot incorrectlyprogrammed dot org/CRC/ to see what I mean. This is driving me mad. Any help appreciated!! reflectionstour.com ^ Site I am working on. So I have these nice little gifs that are curving the corners. In FF3 they work fine and it is XHTML/CSS 2.1 valid. Which of course means that they are not working right in IE 7 (haven't bothered testing 8, as I run Linux and it is hard enough to locate an IE7 to test it on.) So I have tried a few different searches and don't really know what to even call it. And no webdev tool bar on IE to help tell me. "vertical-align: bottom IE7 ~padding" "bottom padding issues IE7" I would rather not do separate CSS sheets as it is a simple site, there shouldn't be an issue here. Thanks! Wil Hi, Does anyone know how to veritcally align text using CSS? like <tr valign='middle'> when using tables. My page is on: http://www.3003online.com/demos/ecoceylon/v2/ You can see a difference in the "Home - About Us - Products - Contact Us" links when viewing from IE and Mozilla Firefox. Basically, I would like the text to be centered vertically in the bar... but CSS by default puts it on top. I tried adding padding,which helped in IE... but Firefox still shows the links a bit higher than they should be.,... any ideas how to fix this? Also, a different problem in case anyone knows how to fix it... you can see a small brown bar on the top bar. It is 50px in height. But I have no idea how to make its width as wide as the remainder of the page (this would change with different resolutions). The main content of the page is 760px wide. I would like a brown box next to that, which is 50px in height and the remainder width. Any ideas? "width: auto;" doesn't work unfortunately [ this is a follow up to my previous thread http://forums.devshed.com/showthread.php?t=270438 Any help would be greatly appreciated. Thanks very much. Hi all, I recently started making a site is css and I had no problems until I came to making the navigation bar. Now I want to have like a button effect on the text so I made this: Code: a.navbar:link { display:block; position:absolute; height:25px; width:150px; background-color:#FFCC99; top:40px; left:0px; z-index:1; } The only problem is that if I apply this to all my navbar links they overlap each other because the positioning is always the same. Any help much appreciated! Jack. Firstly I'm a new member here so hi to everyone. I am fairly new to css. I am trying to create a navbar menu with css, I have used ul and li for the links and its positioned on the left hand side of the page, just where i want it, but my problem is I cant seem to get my text paragraphs to lie at the side of the navbar, they either are above it or below it, obviously im doing something wrong but not sure what. Many Thanks. I found a horizontal Dropdown menu I really want to emulate he Austin360.com What I like about it is that the widths of the top level list items adjust to the widths of their text -- rather than all being the same width. Also the top level list appears to "stretch" horizontally, filling up the entire width of the container. (Although I can't see any widths anywhere in the stylesheet!) How'd they do that? www. cooperworkskilns.com The CSS worked well for a vertical navbar, but I haven't gotten it to work horizontally. I added a float:left to see if it would do it. This isn't working in IE. Lol, its created a rather interesting stairstep effect. Is there a way to make it span evenly across the page without adjusting the width of each <li>? Also, for some reason the footer <div> margin isn't working in FF. If you look at IE vs FF, there is much more space above the Copyright line. #navbar ul { margin: 0; padding: 0; list-style-type: none; } #navbar li { margin: 0 0 0 0; } #navbar a { float:left; display: block; text-align:center; color: #000; background-color: #FFF; width: 9em; padding: .2em .8em; text-decoration: none; border-top: 1px solid #fff; border-left: 0px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; } #navbar a:hover { background-color: #003366; color: #FFF; border-top: 1px solid #fff; border-left: 0px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; } Hi, Am editing a template within dreamweaver as it saves a lot of time for me but I can figure out how to move the right nav bar down. Am trying to include a screenshot but i can't figure out how as I am a new user and it won't let me link.. Basically, it is a two column layout with a picture under the heading and the nav bar up to the height of the picture. Am looking to expand the picture out right and center meaning the nav bar will have to come down just below the picture if you know what i mean? I have tried with design view, won't let me. Had a look at the code but nothing really there that I picked up on (considering am only a beginner).. any thoughts? Well I trying to build a navbar and I want it to be completely in CSS so I can have it in my styling sheet and only have to edit it once when I add a new page to the navbar. I have it figured out so the formatting for it is in the CSS but the actual items and links to pages are in the HTML, and I want the format and items in the CSS. Here's my CSS for the navbar formatting: Code: #navbar ul { margin: 10px auto auto auto; padding: 6px; list-style-type: none; text-align: left; background-color: #000; font-family: arial; } #navbar ul li { display: inline; font-family: arial; } #navbar ul li a { text-decoration: none; padding: .2em 1em; color: #ffffff; background-color: #000000; font-family: arial; } #navbar ul li a:hover { color: #000000; background-color: #ffffff; font-family: arial; } And here's the code I have in the body of my HTML that adds each of the items to the navbar: Code: <div id="navbar"> <ul> <li><a href="index.html">Home</a></li> <li><a href="gallery.html">Gallery</a></li> <li><a href="irc.html">IRC</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div> Anyone have any ideas on how I would do this? Thanks. I'm very new to CSS, and I'm learning to use div tags for my layout. My navbar is a div within my header div, and it's not lining up the way I'd like. Here's a link for an example: www . cooperworkskilns . com The Home button should be at the bottom left of the header. Here's the pertinent css: #header{ margin:0px 0px 10px 0px; padding:0px; width: 700px; height: 125px; border-bottom: 1px solid #666; background-image:url(../img/header.gif); } #navbar{ margin:0px 0px 0px 0px; padding:0px; width: 700px; } Hello, This is my first post here, so hi everyone. I'm relatively new at css or any of it. I been working on a navbar with a javascript fader. Anyway... I finally got my buttons to work! It's time for the Smirnoff! But my button are still giving me ...! Anyway I was wondering if someone...anyone could please help me before I slam this laptop against the wall! Just joking... Everything checks out with W3C except my buttons. Here's the html: Code: <div> <span id="navcontainer1" class="button1"> <ul> <li> <a href="guardian_angel_figurines.html"><img src="images/homebuttonlight.jpg" alt="Takes You to Home Page" style="filter:alpha(opacity=0)" onmouseover="pWidgets(this,100,50,5)" onmouseout="pWidgets(this,0,50,5)" /></a> </li> </ul> </span> <span id="navcontainer2" class="button2"> <ul> <li> <a href="#"><img src="images/aboutusbuttonlight.jpg" alt="Our Policies, Mission, and Company Information" style="filter:alpha(opacity=0)" onmouseover="pWidgets(this,100,50,5)" onmouseout="pWidgets(this,0,50,5)" /></a> </li> </ul> </span> <span id="navcontainer3" class="button3"> <ul> <li> <a href="#"><img src="images/aboutfigurinesbuttonlight.jpg" alt="For More Information About Figurines" style="filter:alpha(opacity=0)" onmouseover="pWidgets(this,100,50,5)" onmouseout="pWidgets(this,0,50,5)" /></a> </li> </ul> </span> <span id="navcontainer4" class="button4"> <ul> <li> <a href="about_angels.html"><img src="images/aboutangelsbuttonlight.jpg" alt="For Angelic Understandings, Mysteries and More" style="filter:alpha(opacity=0)" onmouseover="pWidgets(this,100,50,5)" onmouseout="pWidgets(this,0,50,5)" /></a> </li> </ul> </span> <span id="navcontainer5" class="button5"> <ul> <li> <a href="policy.html"><img src="images/contactusbuttonlight.jpg" alt="To Contact Us with Your Questions, Sugestions, Ect" style="filter:alpha(opacity=0)" onmouseover="pWidgets(this,100,50,5)" onmouseout="pWidgets(this,0,50,5)" /></a></li> </ul> </span></div> Don't laugh...they work! Here's the stylesheet: Code: .button1 { position: relative; bottom: 100px; right: 40px; } #navcontainer1 ul li { display: block; float: left; background: url("images/homebuttondark.jpg"); } #navcontainer1 a { display: block; width: 140px; height: 30px; } .button2 { position: relative; bottom: 100px; right: 40px; } #navcontainer2 ul li { display: block; float: left; background: url("images/aboutusbuttondark.jpg"); } #navcontainer2 a { display: block; width: 140px; height: 30px; } .button3 { position: relative; bottom: 100px; right: 40px; } #navcontainer3 ul li { display: block; float: left; background: url("images/aboutfigurinesbuttondark.jpg"); } #navcontainer3 a { display: block; width: 140px; height: 30px; } .button4 { position: relative; bottom: 100px; right: 40px; } #navcontainer4 ul li { display: block; float: left; background: url("images/aboutangelsbuttondark.jpg"); } #navcontainer4 a { display: block; width: 140px; height: 30px; } .button5 { position: relative; bottom: 130px; <-----this is weired! all the other buttons lined up with the same coordinates but this strange one. left: 520px; } #navcontainer5 ul li { display: block; float: left; background: url("images/contactusbuttondark.jpg"); } #navcontainer5 a { display: block; width: 140px; height: 30px; } W3C Validation says there is something wrong with the <ul> tag on each button html. I've tried a million different combinations but this is the only way I can get them to work. Only thing is they create empty space around them and unless I put something "above" them they disappear all together (where the go I have know idea!) I was just thinking if they could somehow "validate" then maybe they would be more predictable. Any suggestions? Thanks ive been at this for a while now. i have a navleft.gif, navbody.gif, and navright.gif. what i want to do is make an expandable nav bar with the body repeating on the x axis. every attempt ive made doesnt work. im still fairly new to css. should i have a <div id="nav"> and within this div put a another div with id=navleft and another with navright? no idea how to go about this. any help would be appreciated. Thanks to the forum I've worked out a prior issue but 2 remain in regards to the secondary navigation bar. 1. Width - If I use a value of 25% for the pages with 4 sub-links (i.e. "The Music" main) it spans the full width of the right column but in IE6 it pushes the box below it down abot 10px. In OP7, NS6, NS7 & Mozilla1.7 it displays properly. 2. a:hover - I can't seem to figure how to make the hover effect respond to mousing over all parts of the box. It only activates when hovering over the text portion. Works properly in the main-nav but not for the sub-nav (note - this is also ONLY IE related). Really not important unless it is an easy fix. I have tested this site in IE6, NS6.2, NS7.1, OP7.5, Moz1.7. I know v4 browsers are a lost cause but if you could confirm success/failure in others I would appreciate it. Regards, Golem2 I'm having trouble getting my dropdown navbar to stretch the width of the parent container. I can get it almost the right width but I have to make the width 107.16px which seems really stupid and wrong to me. But if I change it to 100% the list becomes vertical and all jacked up. Any clues on how to get it to stretch the entire width of the container? link Thanks! edit: I added the follow css to get rid of the white border at the end of the navbar. It looks good in FF but in IE there's a small gap now between the navbar & the side of the container. I'm hoping that there's a better way to do this. Code: #contact_nav a {border:none;} /*Removes right border on end of navbar*/ |