CSS - Trouble With Floating.
I'm trying to float my navigation to the right side of the screen, but not messing up the order of the links. (left to right as in 1.2.3.4.5).
The problem I'm having is the links go right, but so does the order of the links (they show right to left 5.4.3.2.1). Here's the CSS: Code: ul#nav { width: 890px; font-size: 0.70em; list-style: none; padding: 0; margin-top: 3em; float: left; clear: both; } ul#nav li { background-color: #0776a0; text-align: left; float: right; text-transform: uppercase; border-right: 2px solid #279bd5; display: block; } ul#nav li a, ul#nav li a:visited { display: block; padding: 0.4em 4em 0.4em 0.4em; color: #FFF; text-decoration: none; } ul#nav li a:hover { color: #FFF; background-color: #279bd5; text-decoration: none; } ul#nav li a.current, ul#nav li a.current:visited, ul#nav li a.current:hover { color: #FFF; text-decoration: none; } And here's the html Code: <ul id="nav"> <li><a href="Home" title="Home">Home</a></li> <li><a href="Example" title="Example">Example</a></li> </ul> Will also post website with the example if asked. Similar TutorialsI am trying to get a footer to position properly on all pages of a site. Because of some absolute positioning I have done using CSS, I resorted to pushing the footer to be formatted that way also. Even though the absolute position is at 670 it is off the bottom of a 1024 x 768 standard webpage for some reason. What I would like to do is get the footer just to display after the last element on the page but I understand that isnt possible since I am using CSS to absolutely position things. The code is something like this: Code: <title>Program Title Stuff</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body background="#ffffff"> <img src="images/top-banner.jpg"> <div id="menubar"> <script src="bubblemenu.js"></script> </div> <p id="separator"> <img src="images/pagesep.jpg"> </p> <p id="title">Section Title Goes Here</p> <div id="contentblock"> { some content goes here such as tables or text } </div> <?php include("footer.inc"); ?> </body> </html> The footer.inc has just your typical links with a separator. The CSS to go with all this is basically font, color, and size. Most elements are absolutely positioned...here is the representative CSS: Code: body { margin: 0; padding: 0; border: none; } a:link {color:#6C9999; text-decoration:none}; a:visited {color:#990099; text-decoration:none} a:hover {color:#CC3333; text-decoration:none} #menubar { position: absolute; left: 25px; top: 95px; border: none; text-decoration: none; } #separator { position: absolute; left: 250px; top: 65px; } #title { font-family: PenultimateLight, Tahoma, "Times New Roman", "MS Sans Serif"; font-size: 18px; font-style: normal; font-weight: bold; color: #3A657B; position: absolute; left: 275px; top: 75px; } #contentblock { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-weight: normal; color: #000000; position: absolute; left: 275px; top: 110px; height: 500px; width: 650px; } #footer3 { position: absolute; top: 550px; font-family: Arial, Helvetica, sans-serif; font-size: x-small; left: 285px; } #footer4 { position: absolute; top: 565px; font-family: Arial, Helvetica, sans-serif; font-size: x-small; left: 370px; font-style: normal; } I'd like to get away from absolutely placing the footer, as the content on each page varies in length. But I cant just center the footer, because other elements are blocked absolute and the footer ends up at the top of the page! Any suggestions? Thanks, Kkathman Here's the html and css for http://www.pxgo.com/lifepak-prime.php - What I really need help with is aligning the footer (I know absolute positioning is bad for me, but relative doesn't work either) and floating my image (which for some reason vanished once I added the floatleft class). Thanks in advance for any help! Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD><TITLE>Lifepak Prime</TITLE> <LINK rel="stylesheet" type="text/css" href="style.css"></HEAD> <BODY> <?php include ("include/head.txt"); ?> <?php include ("include/menu.txt"); ?> <div id="content"><h2>Lifepak Prime</h2><img class="floatleft" src="graphics/lifepak-prime.bmp" width="192" height="192" alt="Lifepak Prime" /> Lifepak Prime contains all the nutrition in Lifepak anti-aging formula <i>and more</i>. Add quality years to your life by providing the vitamins, minerals, and trace elements your body needs to protect and regenerate cells. <br><br>Lifepak Prime all-natural dietary supplements addresses the specific needs of men over 40 and post-menopausal women with BioGinkgo 27/7 extract (ginkgo biloba), milk thistle, glutathione, alpha-lipoic acid, coenzyme Q10, and grape seed extract. <br><br>Lifepak Prime provides 150 IU, or 500 % daily value, of vitamin E, increased levels of B6, B12, and zinc for optimal nutrition intake. Lifepak Prime also provides unique dietary components for bone health, as well as those that support memory and circulation. <br><br>My family uses Lifepak so I'll be happy to answer questions about Lifepak on the <a href="http://www.pxgo.com/discuss/viewforum.php?f=9">Lifepak message board</a>. We'd also love to hear from other people who are using Lifepak. <br><h2>Lifepak information</h2>Lifepak Prime is optimized for men over 40 and post-menopausal women. There is also a Lifepak for pregnant and lactating women (Lifepak PreNatal), Lifepak for woomen from 18-menopause (<a href="lifepak-women.php">Lifepak Women</a>), and adults from 18 to 40 (<a href="lifepak.php">Lifepak anti-aging formula</a>). <br><br>Lifepak is a vitmain, mineral, phytonutrient supplement. Lifepak is much more than a multiple although it does address common deficincies: <ul><li>Vitamins A, E, and B6 <li>Zinc, iron, calcium, and magnesium for healthy bones <li>Alpha-lipoic acid, vitamins B9 (folic acid), B12, C, E, flavinoids, and carotenoids for the anti-aging processes of cellular protection and cellular regeneration. </ul></div> <br><br> <?php include ("include/ads.txt"); ?><br><br> <?php include ("include/footer.txt"); ?> </BODY></HTML> Code: BODY { margin-left: 0%; margin-right: 0%; margin-top: 0%; font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR:#000000; BACKGROUND-COLOR:#ffffff; } A:link { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} A:visited { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} A:active { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} A:hover { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #FFFFFF; text-decoration: none; BACKGROUND-COLOR:#238c13; font-weight:bold;} FONT {BACKGROUND: none; COLOR: #000000; FONT-SIZE: 13px; FONT-FAMILY: verdana, arial, sans-serif} .titular {COLOR: #000000; background-color:#238c13;} .negro {background-color:#000000; color: #FFFFFF; FONT-SIZE: 12px; FONT-FAMILY: verdana, arial, sans-serif; font-weight:bold;} .floatleft {float: left; border=1; padding=1; margin: 4px;} a { color:#09c; font-size:11px; font-family:verdana, arial, helvetica, sans-serif; font-weight:600; text-decoration:none; } a:link {color:#09c;} a:visited {color:#07a;} a:hover {background-color:#eee;} #head { font-family:verdana, arial, sans-serif; color:#000000; font-size:16px; font-weight:800; background:#238c13; padding:0px; } #head h1 { margin:0px 0px 0px 0px; padding:20px; color:#000000; font-size:18px; font-weight:800; z-index:1; } #head a, #head a:link, #head a:visited, #head a:active, #head a:hover { margin:0px 0px 0px 0px; padding:20px; color:#000000; font-family:verdana, arial, sans-serif; font-size:18px; font-weight:800; text-decoration: none; } /* All the content boxes belong to the content class. */ #content { position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */ width:auto; min-width:200px; margin:30px 170px 20px 220px; border:0px; background-color: #ffffff; padding:10px; color: #000000; font:bold 15px verdana, arial, sans-serif; z-index:5; } #content h2 {font:bold 16px verdana, arial, sans-serif; padding:15px;} #content a:link { font-size: 15px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #content a:visited { font-size: 15px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #content a:active { font-size: 15px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #content a:hover { font-size: 15px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #FFFFFF; text-decoration: none; BACKGROUND-COLOR:#238c13; font-weight:bold;} #navi { position:absolute; width:200px; top:120px; left:20px; border-right:#238c13 2px dotted; background-color:#ffffff; padding:0px; color:#238c13; font:bold 13px verdana, arial, sans-serif; z-index:2; } #navi A:link { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #navi A:visited { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #navi A:active { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #navi A:hover { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #FFFFFF; text-decoration: none; BACKGROUND-COLOR:#238c13; font-weight:bold;} #ads { position:absolute; width:130px; top:100px; right:10px; border-left:#238c13 2px dotted; background-color:#ffffff; padding:10px; z-index:3; } #footer { position:absolute; width:100%; top:730px; margin:10px 0px 0px 0px; padding:10px 0px 0px 0px; border-top:#238c13 2px dotted; background-color:#ffffff; z-index:4; } #footer A:link { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #footer A:visited { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #footer A:active { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #238c13; text-decoration: none; background-color: transparent; font-weight:bold;} #footer A:hover { font-size: 13px; FONT-FAMILY: verdana, arial, sans-serif; COLOR: #FFFFFF; text-decoration: none; BACKGROUND-COLOR:#238c13; font-weight:bold;} So I'm not really new to CSS or HTML though I might as well be considering the last time I did anything in either that had much substance was a class back in high school, about 6 years ago. This is what I want... DIV1 --------------- DIV2 --------------- DIV 3 2 would be in the center with 1 and 3 floating left and right respectively. Instead I'm getting this... DIV1 --- DIV2 ----------------------------------------- DIV 3 or DIV1 DIV2 DIV3 ...I hope you guys get the idea. I'm having trouble figuring it out. My ext CSS sheet, if you care to look, is he http:// livingway.110mb. com/mainstyle.css the frame in question, he http:// livingway.110mb. com/main.htm I'm hoping it'll let you all look at them. It's nothing professional yet because I'm only trying to give an update idea to our "webmaster". Anywho, let me know what I'm doing wrong. My brain hurts right now. Hi, Can someone help me with why the following header bar doesn't work in Firefox? It just shows the very top of the bar with the two other divs inside of it. Code: <div class="cmsHeader"> <div style="float: left;">Page Name</div> <div style="float: right;"><a href="" title='Add Page'><img src='images/icons/file_(add)_16x16.gif' border='0' alt='Add Page'></a></div> </div> .cmsHeader{ background: #809096; padding: 5px; width: 98%; color: #FFFFFF; } .cmsHeader a{ color: #FFFFFF; text-decoration: none; } .cmsHeader a:hover{ text-decoration: underline; } Hi Everyone, I've been doing modest CSS for a while now and feel like I have a good grasp of it, and generally find a way of doing what I want. But, this has always bugged me and I need to understand what is going on... I think it's a question of Floating. This is in reference to http://www.arabellamusic.co.uk I want the blog posts to be on the left, and some other content on the right. How is the best way to go about doing this? You can check my source, but this was my thinking: Code: HTML <div class='inner'> <div class='left'> BLOG PHP HERE </div> <div class='right'> SOME OTHER STUFF HERE </div> </div> And the CSS: .inner { width:788px; } .left { float:left; width:50%; } .right { float:left; width:50%; } If you grab my stylesheet and my source, you will see that I have a couple more things in there, but I don't think they could be affecting the rest (text-align etc...) So, am I doing this wrong? I have floated columns in other websites this way and it sometimes works, sometimes doesn't. Incidentally, once it would only work when I set 49% to each, I was assuming this was something to do with the box model I read about, but wasn't too sure. I will try not to play around with the site too much until I get a reply or two, but a few things may jump around as I try stuff! Thanks in advance... James I currently have the following layout Code: <table> <tr> <td></td> <td></td> </tr> </table> how do i go about making the same layout but using CSS. Each <td> is 50% wide hi, i am a total newbie with css and trying to create a floating divider. an example can be seen at www.payjunction.com. does anyone know a tutorial on how to create one? thanks for the help in advance Learning CSS and trying to emulate the following table: Code: |--------------------------------------| | Text 1 |----------------| | | Text 2 | Inner box text| | | Text 3 |----------------| | |--------------------------------------| I can get a nested div to work vertically but not horizontally. I'm trying: Code: div#container { float: left } div#title { float: right } <div id="container"> hello<br>hello <div id="title"> Text 1<br /> Text 2 </div> </div> Which is producing: Code: |--------------------------------------| | Hello | | Hello | | |----------------| | | | Text 1 | | | | Text 2 | | | |----------------| | |--------------------------------------| Perhaps a positioning thing which I don't understand yet? It's not homework so you don't have to do it for me, but rather you could just point to knowledge sources.... Tx! I have 3 tables in a div. I have two of the tables one on top of the other. I wanted to place the third table to the left of the bottom table. So I placed the second table relative and left -50px. I placed the third with position absolute, top -70px and float right to achieve this layout. Is there a better way of doing this out of curiousity? I have recently created a design in which the main content and sidebar are both floated right, but I've been having a problem. For whatever reason, the main content has been floating slightly below my sidebar. Could anyone please look at the code and tell me how to fix it? Thanks a ton, go here to view my problematic design. I've had to write the address differently because "new user accounts are not permitted to create posts containing URLs." wendyhenrichs (dot) com (slash) pin. If you had trouble understanding my above message, here's the address with spaces in them (just remove the spaces in your address bar): http:// www . wendyhenrichs . com / pin Please just take a quick look. Thanks! I need to center a div which contains two columns. Its important that the div encapsulates the content within. This is what I've done so far: CSS: Code: * { margin: 0; padding: 0; } #container { float: left; width: 960px; border: 1px solid #000000; } .left { float: left; width: 650px; } .right { float: left; width: 250px; } HTML: Code: <div id="container"> <div class="left"> left content goes here </div> <div class="right"> right content goes here </div> </div> Question: Is it possible to center #container to the middle of the page? Using margin: 0 auto; doesnt work with floating divs. Its very important that #container has a border around .left and .right. Any help will be appreciated I have a DIV element in a menu system that pops up when you hover over the parent menu. Everything in the menu works fine, however I need to embeed the navigation including the menu into a frame where the menu sits flush with the bottom of the frame it's in and when you mouse over the parent element the DIV that pops up is hidden by the frame below it. Like so: --- frame 1 ------ <content> <menu> --- frame 2 ------ <main content> ... ... ------------------ Is there anyway with CSS to tell the DIV to float above the bottom frame? Hi All I seem to have an issue with floating an element in IE6&7. All other browsers (including IE8) are fine. When using a right float element, IE7 seems to push the elements to the left of it below the right-floated element, instead of to the left where they are suppose to be. Is there a work-a-round and/or hack for this? Cheers! Russ Hey All: This is my first post to this forum. Any and all assistance is greatly appreciated! I am having an issue with some floating div's. I'm sure it's as easy as moving the div to a different parent but, I'm having trouble figuring this one out. My site is pretty simple. Most of the div's are floating left. I have one div that is floating right. I want the right div to stretch or contract to the full height of the content. Most of my content fits into a 740px height. There are a few that are more (up to 1500px). So, I want to put 1500px worth of images in the right column but only show as much as needed to fit the content area (most of the time only 740px). Right now, the full height of the right div is showing. I would post a link but, I'm new to the forum and it isn't allowed. If there is a way around this, I am happy to provide a link. Thanks in advance for any responses! Jeff hey I am trying to get this sub menu floating on the rollover of a list item. Here's my HTML: Code: <body> <div id="banner"> </div> <div id="leftmenu"> <ul> <li>List 1</li> <li><a href="">List 2</a></li> <li><a href="">List 3</a> <ul> <li><a href="">List 3.1</a></li> <li><a href="">List 3.2</a></li> <li><a href="">List 3.3</a></li> <li><a href="">List 3.4</a></li> </ul> </li> <li><a href="">List 4</a></li> <li><a href="">List 5</a></li> <li><a href="">List 6</a></li> <li><a href="">List 7</a></li> <li><a href="">List 8</a></li> <li><a href="">List 9</a></li> </ul> </div> <div id="maincontent"> CONTENT </div> </body> and this CSS: Code: #leftmenu { position: absolute; margin: 0px; top: 120px; left: 0px; width: 147px; height: 800px; background-color: #cccc66; font-size: 10px; font-weight: bold; } ul { padding: 0; margin: 0; list-style: none; } ul li { color: #FFFFFF; display: block; background-color: #FF0000; margin-bottom: 1px; text-align: right; font-weight: bold; } ul li a { text-decoration: none; color: #FFFFFF; } ul li a:hover { color: #000000; } ul li ul { display: none; position: absolute; top: 200px; left: 100px; } #maincontent { position: absolute; z-index: 0; left: 147px; top: 120px; height: 381px; width: 100%; padding-top: 10px; padding-left: 10px; margin-top: 0px; margin-left: 0px; background-color: #FFFFFF; font-family: Arial; font-size: 13px; } so yeah, I am struggling at this point, I have looked at a reference that someone gave me last time I brought up the issue, but can't get it working, if you can spot why, help would be appreciated, not having much luck, thinking maybe a syntax thing(?), not sure...HELP!! kr. I've got a really weird situation happening in IE7, and I can't figure out what I could possibly be doing wrong. I've got two divs on a page - one floating left, the other right. Each div contains two fieldsets, none of which are floated. This is the general setup: HTML Code: <div id="colRight"> <fieldset id="serviceArea"> ... </fieldset> <fieldset id="defineArea"> ... </fieldset> </div> <div id="colLeft"> <fieldset id="profile"> ... </fieldset> <fieldset id="profileBio"> ... </fieldset> </div> CSS Code: #colLeft { float:left; margin-right:15px; } #colRight { float:right; } fieldset { padding:0 1em 1em 1em; margin-bottom:1em; } fieldset#defineArea, fieldset#serviceArea { float:none; width:230px; padding:0 10px 10px 10px; } Everything lines up perfectly in IE8, FF3.6 and Chrome, but in IE7 (actually, IE8 in Compatibility Mode) #serviceArea floats to the left of #defineArea (or vice-versa) in #colRight, and #colLeft gets pushed down below the now-too-wide #colRight. Since fieldsets are block-level elements, how can they be floating, especially when I explicitly set them to float:none? There's a stripped-down version of the page at http://www.weddingpastorsusa.org/design2/test_editform.html. Any help would be greatly appreciated. Hi again could someone help me figure out why my left and right box's on thid design are not inline with the content (middle) box thanks see attached pic to see what i mean. Code: CSS CODE body { background:#ffffff; color:#000000; font:76% Verdana,Tahoma,Arial,sans-serif; margin:0; padding:0; text-align:center; } /*** Main container ***/ #container { background:#EAEAEA url() repeat-x; color:#000000; width:90%; margin:5px; min-width:770px; padding:0; } /*** Content ***/ #content { background-color:#EEEEEE; border:1px solid #DEDEDE; color:#000000; padding:15px 20px 5px; height:500px; margin:5px; } /*** Main Banner ***/ #Banner { background-color:#EEEEEE; height:55px; border:1px solid #DEDEDE; padding:15px 20px 5px; margin:5px; } /*** Left Side Navigation ***/ #SideNav { width:15%; float:left; background-color:#EEEEEE; border:1px solid #DEDEDE; color:#000000; min-width:200px; padding:15px 20px 5px; margin:3px; } /*** Right Side content ***/ #RightCon { float:right; width:15%; background-color:#EEEEEE; border:1px solid #DEDEDE; color:#000000; padding:15px 20px 5px; min-width:200px; margin:3px; } Thanks Hello, can anyone help me with this? I'm having trouble floating some divs and I can't find the problem. 1. navigation should be aligned with the bottom of the h1 logo 2. the content div should come next to the list of brands. The content div should overlap the black bg at the top. www. claeysconsult . be / misskado / index2.html Thanks in advance... I saw this appealing menu from a css contest page and i've studied the code over and over again but i can't seem to get the same effect as this person has done. He has created a menu that just floats while the screen is able to scroll up and down. the site is : http://contest.prestontalk.com/index/FluidFixed/0/4/1/ if anyone knows how this effect is done, let me know. thanks! Hello. I spoke with some css developers yesterday on IRC but they failed to fix the problem. They suggested me to ask here for help so I will. I am currently making a new homepage and this is my page; mg-s.org/newly/ I had to edit most of the .css because the page was "floating". Like, some people couldn't see everything and if we zoomed in or out then the page got messed up.. So here is the current progress: mg-s.org/newly/ which is messed up. It's supposed to look like this: pokit.org/get/?00e5090c7ab5a0972f325bb16608f6fb.jpg But as you can see it's not. Here is the style.css : pastebin.com/BPrfZuBd Here is the index.php : pastebin.com/BDQKcxCE I am not that familiar with css so I need help. I've already editing on the size in the .css like on "top" to fix the #panel so it goes futher up but it's not working. Same with the #rightmenu |