CSS - How To Make A 3-column Menu
Hey everyone,
I'm trying to make a menu at the top of my page that will display 3 equally-sized boxes, each containing 4 links under each other. But for some reason, it isn't working. HTML code: Code: <div id="ie_center"> <div id="nav_boxes_outer"> <div class="floatbox" style="float: left;"> <center><a href="view_table.php" style="text-decoration: none;">View table</a><br>Liz Gargon</center> </div> <div class="floatbox" style="float: right;"> <center><a href="email.php" style="text-decoration: none;">Email</a><br>Paul Duggan</center> </div> <div class="floatbox"> <center><a href="view_users.php" style="text-decoration: none;">View users</a><br>Anthony Murnane</center> </div> </div> </div> I've tried changing the alignment of the float for each box, but it doesn't work. CSS code: Code: #ie_center { width: 100%; text-align: center; } #nav_boxes_outer { width: 100%; height: 120px; margin: 0 auto; margin-top: 20px; } .floatbox { border: 1px #000000 solid; position: relative; margin: 0 auto; width: 30%; height: 120px; text-align: left; background-color: #DDDDDD; float: none; display: inline; } Does anybody have any ideas? Thanks in advance Similar Tutorialscan i make my left column, the same height as my right column? or infact, if the left is taller than the right, the right extends to it and if the right is taller than the left the left extends to it? is this possible, cheers heres my css: left column, is #leftNav and the right column is #contentMain PHP Code: #content { margin:0px auto; padding: 0; width: 760px; } #contentMain { padding: 0; margin: 0; float: right; width: 632px; } #leftNav { color: #000; float: left; margin: 0; padding: 0; width: 128px; } hello. I am currently using a simple horizontal top menu with a vertical drop down. I would like to change the vertical drop down to be horizontal, multi column, and should accomodate more than one line, if possible. The example I'm going for is used as top navigation he nfl - baltimore ravens home page and he ge home page Here is the code I'm using currently (would like it to be all CSS). #### ul#mainNavigation { padding-left:185px; } ul#mainNavigation li { padding:0 16px; float: left; display:inline; position: relative; list-style: none; color:White; _width:1px; } ul#mainNavigation li.Seperator { padding:0px; _width:1px; } ul#mainNavigation li.over { background-color:white; } ul#mainNavigation li.over a { color:Red; } ul#mainNavigation li a { color:White; text-transform:uppercase; text-decoration:none; font-weight:bold; display:block; } ul#mainNavigation a:hover { color: Red; } ul#mainNavigation li a { display: block; } ul#mainNavigation li p { height:19px; } ul#mainNavigation li ul { display: none; position: absolute; background-color:Black; opacity:.8; filter: alpha(opacity=80); -moz-opacity: 0.8; margin-left:-16px; } ul#mainNavigation li.over ul { display: block; z-index:999; } ul#mainNavigation li.over ul li { float: none; background:none; border:none; white-space:nowrap; padding:0px; } ul#mainNavigation li.over ul li a { color: white; padding:5px; border-bottom:solid 1px black; } ul#mainNavigation li.over ul li a:hover { background: #3d1f6e; color: white; } ~~~~~~~ HTML ~~~~~~~~~~~~~~ <ul id="mainNavigation"> <li> <p><a href="Mainlink1.html">Mainlink1</a></p> <ul> <li><a href="link2.html">LINK 2</a></li> <li><a href="link3.html">LINK 3</a></li> <li><a href="link4.html">LINK 4</a></li> <li><a href="link5.html">LINK 5</a></li> <li><a href="link6.html">LINK 6</a></li> <li><a href="link7.html">LINK 7</a></li> </ul> </li> <li> <p><a href="Mainlink2.html">Mainlink2</a></p> <ul> <li><a href="link2.html">LINK 2</a></li> <li><a href="link3.html">LINK 3</a></li> <li><a href="link4.html">LINK 4</a></li> <li><a href="link5.html">LINK 5</a></li> <li><a href="link6.html">LINK 6</a></li> <li><a href="link7.html">LINK 7</a></li> </ul> </li> </ul> #### Thank you, in advance! ~ lahddah OK...thbbt. Situation 1 (the one that works as I want) Code: <table style="width: 100%"> <tr> <td style="width: 15em">Column 1</td> <td>Column 2</td> </tr> </table> In Situation 1, the second column expands to be all of the remaining width. This is good. Situation 2 Code: <table style="width: 100%"> <tr> <td style="width: 15em">Column 1</td> <td>Column 2</td> <td>Column 3</td> </tr> </table> In Situation 2, column 2 and 3 share the remaining space. I want column 2 to take no more than exactly the space it needs. I want column 3 to expand to take all the remaining space. The only way I've found that (sorta) works is to actually use the old HTML width="" attribute and make it a percentage that's impossible. If you make it 95% or something, then all the other columns squeeze down pretty far. The issue with this approach is that it ignores the style width of the first column and just crushes it as much as possible. Anyone have an idea? Thanks Tim Hi! I want to make a two-column menu with lists, is that possible, or do I need to make two UL's? Code: item 1 | item 2 item 3 | item 4 item 5 | item 6 <ul> <li/>item 1 <li/>item 3 <li/>item 5 </ul> <ul> <li/>item 2 <li/>item 4 <li/>item 6 </ul> Is there a better way? /Chrille Please forgive me if this is just a stupid mistake, I'm pretty much a CSS newbie. I generated a CSS menu (http://www.webmaster-toolkit.com/css-menu-generator.shtml) and inserted it into my CSS file. The menu is ok, but it pushed my center column down so that it only touches at a corner, when it should be leveled up and touching along the side. Here's the relevant code: Quote: #c-col{ position: relative; margin: 0px 74px 20px 180px; border: 1px solid #003366; background: #333366; color: #CCFFFF; padding: 20px; z-index: 3; } .buttonscontainer {width: 174px;} .buttons a {color: #333366; border: 1px solid; background-color: #336699; padding: 2px; padding-left: 3px; font: 12px Arial, sans-serif; font-weight: bold; text-decoration: none; border-color: #9999CC #333366 #333366 #9999CC; display: block; margin: 0px; width: 100%; text-align: left;} .buttons a:hover {border: 1px solid; padding-left: 4px; padding-top: 3px; padding-bottom: 1px; padding-right: 1px; background-color: #6666CC; border-color: #333366 #9999CC #9999CC #333366; color: #333366; text-decoration: none;} Have I inserted it in the wrong place or is there something missing/redundant? I'd appreciate any suggestions. Hi, Ive got a joomla worksite and it has a menu on footer. The menu uses the following css code : #footmenu ul { margin: auto; padding: 0; list-style:none; margin-top:7px; } #footmenu li { float:left; border-right: 2px solid #fff; background: none; padding: 0; display: inline; padding: 10 10px; } } #footmenu a { font-family: Tahoma, Helvetica, sans-serif; font-size: 11px; font-weight: bold; float:left; display:block; height: 25px; line-height: 25px; padding: 0 15px; color: #666; } #footmenu a:hover { /*background: #e1e1e1; */ color:#98aa65; } I have read some posts and articles on the web but i didnt have any luck with it. I could make it align in left or right but not in the middle. From what i read, i have to align the whole div as one part, dunno Any help appreciated, Thanks Newb alert! I'm not sure if CSS is the way to do what I want or not, but I'm guessing it is. I want a horizontal menu (header) across the top that does not move. The page below should be able to scroll but when it pass under the menu it should disappear. You can probably tell I'm trying to eliminate using frames for menus in an application I work on. I've seen a lot of using position:fixed which won't work in IE, which it has to of course. Is this possible? If so, is it CSS? It's not homework so you can just point me in the right direction. :-) Have a look at the menu at the top of this page. While it does use some CSS, it doesn't appear to use it for spacing. (In point of fact, this page uses tables quite a bit, though not for that menu). Anyway, if I want to create a top menu (rather than a side menu, perhaps), then how do I evenly space the menu choices across the div (area) that I create for it? Something like: Home Directions Photos Login FAQs About Us but nice and even-spaced across the area designated for it. Naturally, I could do the math and use {position:absolute; left:16%} for each item, but this is a bad substitution for a quick, effective, and not so dirty table. Is there a way to set something up once in CSS that applies to all words or <a>'s or something, within a <div>? Thanks. Ok, I have a website that i'm building with about 25 pages, and I keep on having to change the side navigation bar, and then I have to copy and paste it on each page to update it. IS THERE A WAY FOR ME TO ONLY UPDATE IT ONCE AND IT UPDATES TO ALL THE PAGES? Is the answer css? or i-frames(or whatever it's called) If so, then how would I do this?! PLEASE HELP! Hi I am trying to make a table to display some stuff within a fix sized window. I want to have 5 columns of fixed width and one column that spans the rest of the remaining space. The Idea is to allow the widths of the first 5 columns to be changed by a script and having the last one adapting as needed... html Code: Original - html Code <div class="container"><table cellspacing="0"> <colgroup> <col width="40" /> <col width="220" /> <col width="120" /> <col width="65" /> <col width="40" /> </colgroup> <thead> <tr> <th>A</th> <th>B</th> <th>C</th> <th>D</th> <th>E</th> <th style="width: 100%;></th> </tr> </thead> <tbody> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td style="width: 100%;></td> </tr> </tbody> </table></div> <div class="container"><table cellspacing="0"> <colgroup> <col width="40" /> <col width="220" /> <col width="120" /> <col width="65" /> <col width="40" /> </colgroup> <thead> <tr> <th>A</th> <th>B</th> <th>C</th> <th>D</th> <th>E</th> <th style="width: 100%;></th> </tr> </thead> <tbody> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td style="width: 100%;></td> </tr> </tbody> </table></div> css Code: Original - css Code div.container { height: 400px; width: 800px; overflow: scroll; } table { width: 100%; } td { border-style: solid; border-color: silver; border-width: 0px; padding: 1px 3px; } th { border-style: outset; border-color: silver; border-width: 2px; background: silver; padding: 1px 3px; }
It really does fill the entire space but the last column crushes all the other into their minimal width resulting in linebreaks between words inside the cells... Please help me Hi all, I've tried searching around for this issue, but I've not found any help so far and it's driving me nuts. I hope someone here can advise. This is an abridged version of the site's code for example: Code: <style type="text/css"> <!-- #main1 { padding: 0px; margin: 0px; } #left { width:260px; margin:0; padding:0; float: left; } #left-top { background-image: url(../images/panel-top-left.gif); background-repeat: no-repeat; background-position: center top; height: 16px; margin: 0px; padding: 0px; } #left-middle { background-image: url(../images/panel-middle-left.gif); background-repeat: repeat-y; padding-right: 20px; padding-left: 20px; padding-bottom: 2px; } #left-bottom { background-image: url(../images/panel-bottom-left.gif); background-position: center; height: 18px; } #logo { background-image: url(../images/swalingslogo.gif); background-position: center top; width: 260px; height: 120px; background-repeat: no-repeat; } /* Navigation List */ #navlist { padding-left: 0; margin-bottom:10px; width: 217px; } #navlist li { list-style: none; margin-bottom:4px; padding: 0; font-size:1.2em; line-height:1.8em; width:217px; height:32px; background-image:url(../images/nav2.gif); background-repeat:no-repeat; margin-top: 0; margin-right: 0; margin-left: 0; } #navlist li a:link, #navlist li a:visited { display:block; text-decoration: none; color:#039; width:207px; height:32px; font-weight:bold; padding-top: 2px; padding-right: 5px; padding-bottom: 2px; padding-left: 5px; } #navlist li a:hover { text-decoration: none; color:#FF6600; } /* Testimonials */ div#fscroller { width:200px; height:200px; background-image:url(../images/bg-testimonials.gif); background-repeat:no-repeat; margin-left:8px; } div#fscroller p { margin-left: 10px; margin-right: 10px; margin-top: 10px; margin-bottom: 5px; } /* Middle Column */ #middle { margin-top: 0; margin-right: 0px; margin-bottom: 0; padding-right: 0px; padding-left: 0px; padding-top: 0px; text-align: justify; margin-left: 260px; } #middle #top-left { background-image: url(../images/panel-top-rightleft.gif); height: 16px; font-size: 2px; background-repeat: no-repeat; } #middle #top-right { float: right; margin-top: -16px; background-image: url(../images/panel-top-rightright.gif); height: 16px; width: 20px; font-size: 2px; } #middle a { color: #003399; } #middle a:hover { text-decoration: none; } /** Country Titles **/ #middle h2#unitedkingdom { background-image: url(../images/title-unitedkingdom.gif); background-repeat: no-repeat; height: 26px; width: 201px; margin-bottom: 6px; } #middle h2#antigua { background-image: url(../images/title-antigua.gif); background-repeat: no-repeat; height: 26px; width: 128px; margin-top: 16px; margin-bottom: 6px; } /* Minisite Links */ div.minisite { float: left; } div.minisite span { display: none; } div.minisite a { background-position: top; background-repeat: no-repeat; height: 168px; width: 190px; display: block; } div.minisite a:hover { background-position: bottom; } a#minisite-swimminglessons { background-image: url(../images/swimming-lessons-uk.jpg); } .clear { clear:both; } .hidden { display: none; } .notopgap { margin-top: 0; } .nobottomgap { margin-bottom: 0; } .inside { background: #EFEFEF; padding-left: 10px; padding-right: 10px; } --> </style> <div id="main1"> <div id="left"> <!-- Logo --> <div id="logo"></div> <div id="left-top"></div> <div id="left-middle"> <!-- Navigation --> <!--#include file="../inc/nav2.asp" --> <!-- Testimonials --> <!--#include file="../inc/testimonials.asp" --> <!--#include file="../inc/special-offers.asp" --> </div> <div id="left-bottom"></div> </div> <!-- Middle Column --> <a name="skipnav" class="hidden"></a> <div id="middle"> <div class="top-left"></div><div class="top-right"></div> <div class="insideleft"><div class="insideright"><div class="inside"><div class="gap-saver"></div> <!-- UK Sites --> <h2 id="unitedkingdom"><span class="hidden">United Kingdom</span></h2> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swimming Lessons</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings Training</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings Residential Courses</span></a></div> <div class="clear"></div> <!-- Antigua Sites --> <h2 id="antigua"><span class="hidden">Antigua</span></h2> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings Soccer</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings Parties and Events</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings International School of Swimming</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings Babysitting and Nanny Agency</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings School of Rugby</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings School of Volleyball</span></a></div> <div class="minisite"><a id="minisite-swimminglessons" href="(URL address blocked: See forum rules)"><span>Swalings Training</span></a></div> <div class="clear"></div> <div class="gap-saver"></div> </div></div></div> <div class="bottom-left"></div><div class="bottom-right"></div> </div> <!-- End Middle Column --> </div> I've placed the Country Title in an H2 tag, then beneath that, each anchor is enclosed in a DIV, and is set as a left-floated block. Then I placed a spacer DIV (clear: both) to create a new line, then repeated with H2 and links. This all works fine in Firefox, IE7 and Opera, but of course IE6 is being a pig as usual. The spacer DIV is pushed to sit alongside the bottom of the left column, and I can't figure out how to (or if I can) stop this. I can't add in links properly, so I hope this is acceptable under the rules -- The site in question is: www.swalings .com/swalings/index4.asp and here's a screenshot of IE6 behaviour: www.swalings .com/images/swalings-ie6-troubleshoot.jpg Hopefully that's enough information to go on, please let me know if there's something I missed out. Thanks a lot! Rob Question title: A 2 column layout, let only the second column scroll horizontally and let them both scroll vertically Hello I did try several idea's, but all failed. Then I did search the web but found a list of > 400.000 in google. If someone is willing to tell me if it is possible and give me some directions, please do. Everything is welcome. I got a list with 3 columns ( basically you could say I have only two columns because 2-3 could be concatenated to together, but they have a different style and justification, but I could live to start with a two column sample) f.e line 1 : value_one - ( some_text - value_two (right justified) ) line 2 : value_one - ( some_text - value_two (right justified) ) line 99:.... e.t.c Column one has a fixed width of 32px. 'some text' can be longer then the wide available and value_two is with 3 spaces appended to column 2. I want that column one is fixed horizontal and that the second and the third column can scroll horizontally. Of course when there are more line's then the height of the container is should be posable to scroll vertically. Finally I need the color behind column one be different then the column 2 and 3. So what I did create is a container with two containers where the left one has a different colour then the right one and above those a container with the list. I have overflow on auto, so I get scroll-bars when necessarily. But my problem is that when I scroll horizontally that my first column scrolls away to the left. Basically my question is. How can I get a 2 column layout, let only the second column scroll horizontally ( first is locked in horizontal place ) and let them scroll both vertically? Hey, So I have a three column layout being implemented as such: html: Code: <div class="content"> <div class="col1 column"></div> <div class="col3 column"></div> <div class="col2 column"> <div class="header">Header</div> </div> </div> CSS: Code: .column { padding: 10px; position:relative; } .header { background:#cfe6f5; color:#416383; font-size:11px; font-family:Arial; font-weight:300; padding-left:15px; } .col1 { float: left; width:250px; } .col2 { margin-left: auto; margin-right: auto; } .col3 { float:right; width:250px; } The problem is that the width of the header div extends all the way to the left and right of the page when it's in the middle column, but behaves the way I want it to (extends to the left and right of the column) when it's in the left or right column. Any ideas? Thanks. --Surgery Hello, I am having difficulty with the center column on the following page: http://cbo4edu.org/index2.html I want to widen the center column so that the CBO NEWS heading touches the blue line which divides the center and right column. When I try to add width to the style sheet the left column moves out of alignment. Any help is much appreciated, thanks! Hi, hopefully you enjoyed the title, I had a good laugh thinking of it in that split second it took me to write it. So, I found a 3 column css layout on a CSS generator website, because I got sick of trying to hack up layouts I've made in the past that didn't work. Anyhow, it was working fine with one line of content in each column when I tested it out, however, once content in the middle column was added, and stretched vertically beyond a certain point, it will drag the left columns content down with it. The right column is not affected in any way. I have spent a few hours trying to look for reasons as to why it would happen, but I had no luck. I would appreciate any help... so thank you in advance if you take a stab at it. Here's the html: Code: <body> <div id="pagewidth"> <div id="header"></div> <div id="wrapper" class="clearfix" > <div id="twocols" class="clearfix"> <div id="maincol">Main Text, woot. (aka hi hi hi)</div> <div id="rightcol">Sidebar, yippee.</div> </div> <div id="leftcol"> <div id="navigation">test</div> </div> </div> <div id="footer"></div> </div> </body> and the CSS: Code: html, body { background: #333399; margin:0; padding:0; text-align:center; font-family: Verdana, Arial, Tahoma; font-size: 12px; font-weight: normal; color: black; } #pagewidth { width: 750px; text-align:left; margin-left:auto; margin-right:auto; background: #333399 url('images/bodycontent.gif') repeat-y center top; } #header { position:relative; height:138px; background: url('images/header.gif') center; width: 100%; } #leftcol { width: 118px; float: left; left: 25px; position: relative; background-color: transparent; margin:0; padding:0; } #twocols { width: 700px; float: right; position: relative; } #rightcol { width:180px; right: 25px; float:right; position:relative; background-color: transparent; } #maincol { background-color: transparent; float: left; left: 100px; display: inline; position: relative; width: 390px; } #footer { text-align: center; height:39px; background: url('images/footer.gif'); clear:both; } .clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clearfix{display: inline-table;} /* Hides from IE-mac \*/ * html .clearfix{height: 1%;} .clearfix{display: block;} /* End hide from IE-mac */ /*printer styles*/ @media print{ /*hide the left column when printing*/ #leftcol{display:none;} /*hide the right column when printing*/ #rightcol{display:none;} #twocols, #maincol{width:100%; float:none;} } Again, thank you in advance if you can come up with anything. hi all, right have got a problem which has been bugging me for days now. i have 4 columns in a row (inside a wapper div)which all will have different content image, text other divs/classes etc. now one of these columns will be quite fluid as it will have different text on each page meaning it will be quite long on some pages not on others. the problem i am getting is in the good browsers firefox etc its ok in IE6+. the wapper does'nt seem to see the divs in the content meaning it does not get filled, meaning that the footer flys to the top and not where it should be, i dont have a live version but heres the code: mainly thanks Dan <!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>Untitled Document</title> <style type="text/css"> <!-- #con { width:940px; height:400px; background-color:#00FFFF; } #wapper { width:940px; background-color:#006666; } #box { width:940px; background-color:#000033; height:40px; } #menu-pronuptia { width:185px; background-color:#6633CC; float:left; display:inline; } #menu-pronuptia1 { width:185px; background-color:#009900; display:inline; float:left; } #menu-pronuptia2 { width:385px; background-color:#0033CC; display:inline; float:left; clear:inherit; } #menu-pronuptia3 { width:185px; background-color:#CCCC33; display:inline; float:left; } --> </style> </head> <body> <div id="wapper"> <div id="menu-pronuptia"> <p>test</p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <div id="menu-pronuptia1"> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <div id="menu-pronuptia2"> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <div id="menu-pronuptia3"> <p> </p> <p> </p> <p> </p> <p> </p> </div> </div> <div id="box"> <p><br /> </div> </body> </html> Hello! I'm new to CSS, so any help would be greatly appreciated! I'm working on this page: sugarhooker[dot]com/testing/index2.html *The CSS is included in the head The right column is suppose to start where it says 'Are you hooked...' It should be right underneath the navigation bar. Anyone know what I'm doing wrong? Thanks in advance! Hi, http://www.dudley.nhs.uk/search.asp has a two column effect. The CSS for it is he http://www.dudley.nhs.uk/css/screen.css I was wondering why if there is a table in the right hand column with a width percentage over 77% there is some horizontal scrolling? This happens in IE. Any help would be greatly appreciated. Thanks. Janusz Jasinski |