CSS - Using Clear To Make A Footer
Every time I run the code below my copyright always winds up at the top of the page. If I remove the button div and place normal html in the code the foot works the way I want. I just seem to get messed up with the divs. Any help will be appreciated
Andy #foot { clear: both; color: #000; } #foot p { margin: 4px; text-align: center; } #button { position: absolute; padding: 0px; top: 40px; left: 150px; width: 5%; } <html> <head> <title></title> <link href="include/styles.css" rel="stylesheet" type="text/css" media="all"> </head> <body> <div id="button"> <img src="images/button.bmp"> </div> <div id="foot"> <p>Copyright 2007 </p> </div> </body> </html> Similar TutorialsHey everyone, I am working on a design for a friend. and I got it almost done, but for some reason, the footer does not display below the page. In no browser. Here is my code: 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" xml:lang="en" lang="en"> <head> <title>BlackNine</title> <script type="text/JavaScript" src="rounded_corners_lite.inc.js"></script> <style type="text/css"> body { background-color: #4D4D4D; color: #FFFFFF; font-family: verdana,tahoma,san-serif,arial; font-size: 13px; margin: 0; padding: 0; } a img { border: 0; } a, a:link, a:visited, a:hover, a:active { color: #ff9600; text-decoration: underline; } a:hover { color: #000000; } li { background-image:url(li.jpg); background-repeat:no-repeat; background-position:left; list-style-type: none; padding-left: 18px; } #header { width: 100%; } #header h1 { color: #ff9600; font-size: 25px; padding-top: 5px; } #header h2 { position: absolute; top: 0; padding-left: 55px; color: #CCCCCC; font-size: 13px; } #main { border-top: 5px solid #0042ff; border-bottom: 5px solid #0042ff; position: absolute; background-color: #FFFFFF; height: auto; margin: 0; width: 98%; color: #000000; padding-right: 2%; } #main h1 { color: #ff9600; font-size: 19px; } #main p { text-indent: 55px; } #rightCol { float: right; width: 20%; position: absolute; right: 0; height: 100%; border-left: 1px dotted #ff9600; } #leftCol { float: left; width: 75%; padding: 2%; } #footer { text-align: center; clear: both; } </style> </head> <body> <div id="header"> <h2>I am so fly</h2> <h1>BlackNine</h1> </div> <div id="main"> <div id="rightCol"> <ul> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> </ul> </div> <div id="leftCol"> sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf sdfgfgf fsadfsdfsdfjasdklfjsadfksdjf </div> </div> <div id="footer"> asdfsafjsdkf sdafkljsdfk lsdlkfjsd afkljsdfsdklfjsdf asdfksdjf </div> </body> </html> Here is what it looks like. Any suggestions? I seem to be having a bit of a problem with a layout I am attempting...here is the problem... First of all, this is a 4 column layout with an absolutely positioned header. The 4 columns use floats for positioning as I am trying to keep a natural code flow. The 4 columns are intended to expand and contract with the page's width, and the heights should be 100%. The content of the page flows below the fold of the page on nearly every page. My problem is with the 100% height. In Firefox the footer that I am using to clear the floats is not clearing them, but rather resting below the floats. Does anyone have a good reference for using floats with 100% height that flow below the fold of the page? If someone wants to take a look at an example, you should message me as I can't post the development site publicly. Hi. How to make my header and footer stick to bottom? For the header div, I have background image and a logo (test) but the bg image does stick to the bottom to touch the menu? For the footer, it doesn't stick to the bottom of the page? Anyone can help me out? Here's the link of the test page with css inside the source code. Really appreciate if anyone can help. Thank you. yourbestproduct dot com/test.html (Sorry, I'm new user so can't put exact url) I actually have two problems... Installing hte firebug plugin for firefox may ease helping me out... The problem is with http:// kthxbai2u<dot>com I cant for the life of me center the "content" div. I have tried every method I found on the first 4 pages of Google. The only thing I can think of is that it is inheriting something wierd or I am missing something simple... The second problem, I can't seem to make the left and right side bar expand to meet up with the footer wayy down at the bottom of the page. I want that div to make a column the whole way down. If anyone can help me out, it would be more than appreciated! Thanks I'm having trouble with my website structure... view this page for an example... css is here... The Footer (which currently consists just of the validation images) is suppossed to be at the bottom of the page... It works in IE except there is a little line between the images (it is also part of the link...), and it doesn't work at all in FF... how do I get rid of the line in IE, and what do I need to add or change in my css to get it to be viewed properly in FF? Thanks Bryan I have a site with a bunch of floats. It looks something like this: [HTML]<div id="nav" style="float: left"> </div> <div id="content"> <div style="float: left"> </div> <div style="float: right"> </div> <br style="clear: both" </div>[/HTML] Now that clear:both also clears #nav instead of the two divs in #content. Is there any way to fix this so it doesn't clear #nav? Hello, The divs numbered #4(extra2) and #5(navigation2) cannot give way to other divs . How can I clear the other divs? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Template 8</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <style type="text/css"> html,body{margin:0;padding:0} body{font: 76% arial,sans-serif;text-align:center} p{margin:0 10px 10px} a{display:block;color:#981793;padding:10px} div#header h1{height:80px;line-height:80px;margin:0; padding-left:10px;background: #EEE;color: #79B30B} div#container{text-align:left} div#content p{line-height:1.4} div#navigation{background:#B9CAFF} div#navigation2{background:#CC33FF} div#extra{background:#FF8539} div#extra2{background:#996633} div#footer{background: #333;color: #FFF} div#footer p{margin:0;padding:5px 10px} div#container{width:700px;margin:0 auto} div#wrapper{float:left;width:100%} div#content{margin: 0 150px} div#navigation{float:left;width:150px;margin-left:-150px} div#navigation2{float:left;width:150px;margin:170px 0 0 -150px} div#extra{float:left;width:150px;margin-left:-700px} div#extra2{float:left;width:150px;margin:170px 0 0 -700px} div#footer{clear:left;width:100%} </style> </head> <body> <div id="container"> <div id="header"> <h1>website name</h1> </div> <div id="wrapper"> <div id="content"> <p><strong>1) Content here.</strong> column long long column very long fill fill fill long text text column text silly very make long very fill silly make make long make text fill very long text column silly silly very column long very column filler fill long make filler long silly very long silly silly silly long filler make column filler make silly long long fill very.</p> <p>very make make fill silly long long filler column long make silly silly column filler fill fill very filler text fill filler column make fill make text very make make very fill fill long make very filler column very long very filler silly very make filler silly make make column column </p> <p>fill long make long text very make long fill column make text very silly column filler silly text fill text filler filler filler make make make make text filler fill column filler make silly make text text fill make very filler column very </p> <p>column text long column make silly long text filler silly very very very long filler fill very fill silly very make make filler text filler text make silly text text long fill fill make text fill long text very silly long long filler filler fill silly long make column make silly long column long make very column long make </p> </div> </div> <div id="navigation"> <p><strong>2) Navigation here.</strong> long long fill filler very fill column column silly filler very filler fill fill filler text fill very silly fill text filler silly silly filler fill very make fill column text column very very column fill fill very silly column silly silly fill fill long fillercolumn fill fill very silly column silly silly fill fill long filler column fill fill very silly column silly silly fill fill long filler column fill fill very silly column silly silly fill fill long filler </p> </div> <div id="navigation2"> <p><strong>5) Cannot clear above div (id=Navigation).</strong> cannot clear above div, this div should be below the div NAVIGATION</p> </div> <div id="extra"> <p><strong>3) More stuff here.</strong> column long make silly silly filler silly very very very long column filler fill make column make silly column fill silly column long make silly filler column filler silly long long column fill silly column very filler silly long long column fill silly column very filler silly long long column fill silly column very filler silly long long column fill silly column very filler silly long long column fill silly column very </p> </div> <div id="extra2"> <p><strong>4) Cannot clear above div (id=EXTRA).</strong> cannot clear above div, this div should be below the div EXTRA </p> </div> <div id="footer"><p>Here it goes the footer</p></div> </div> </body> </html> Can someone explain to my why my "spacer" div is not working (i'm looking in IE7 & Firefox)? Here's the page (I put a 1p border around the "clear" div so that you can see it for testing): http://www.welcome-home-interiors.net/services.php Below is the HTML and CSS... HTML: Code: <body> <div id="container"> <div id="header"> <?php include('includes/flashHeader.php'); ?> </div> <div id="nav"> <?php include('includes/navbar.php'); ?> </div> <div id="maincontent"> <div id="mainLeftText"> <p><img src="images/headers/services.gif" alt="SERVICES" width="188" height="49" /></p> <div id="mainLeft"> <p><span class="header">INTERIOR DESIGN</span><br /> Whether it's simply choosing a paint color or extensively remodeling a kitchen, Welcome Home Interiors can offer you guidance. Space planning and 3D Images are available so that you can visualize your room and make changes before any labor or purchasing is made.</p> <p><span class="header">REAL ESTATE STAGING</span><br /> "Set the Stage" by rearranging current furnishings and accessories to create your own "model home" - spacious, fresh, and beautiful - exactly what buyers are looking for! As trained professionals, Welcome Home Interiors will assist you in establishing a perfect first impression - an important factor in selling your home for the highest price and in the shortest amount of time. In a 1 to 2 hour consultation we will offer suggestions to enhance your home easily and economically, and leave you the comprehensive list of tasks we've discussed. If you'd prefer, you can enjoy the instant gratification of having us rearrange your space on the spot. We also can add pieces from our inventory to enhance your belongings or even fill your vacant home.</p> <p><span class="header">ROOM REDESIGN</span><br /> Welcome Home Interiors can give your room a whole new look using the furniture and accessories currently in your home. Want to add a few fresh pieces? Let us provide you with a design plan tailored to meet your lifestyle. We can roll up our sleeves and complete the look for you, or turn over the plan for the "do-it-yourselfers".</p> <p><span class="header">SHOPPING</span><br /> Do you get overwhelmed by all the options? Or just don't have time to shop? Let's discuss the look you're dreaming of and establish a budget, then Welcome Home Interiors will locate it and bring it to you.</p> <p><span class="header">YOUR NEW PLACE</span><br /> Welcome Home Interiors will recycle your existing furnishings into your new home. We will offer answers to all of those design questions about paint, window treatments, and finishing touches so you'll soon have the "at home" feeling in your new surroundings.</p> <p><span class="header">GIFT CERTIFICATES</span><br /> Welcome Home Interiors GIFT CERTIFICATES make wonderful hostess, house warming, wedding, birthday, and special occasion gifts. They can be customized to your needs.</p> <p><span class="header">FEES</span><br /> Together, Lori and Teri of Welcome Home Interiors are $75.oo an hour for design consulting. Prop rental for real estate staging is quoted per room.</p> </div> </div> <div id="mainRight"> <p><img src="images/indexPic.jpg" alt="Welcome Home Interiors" width="310" height="415" /></p> </div> <div class="spacer"> </div> </div> </div> </body> CSS: Code: html, body { background: #DACCCC; font-family: Georgia, "Times New Roman", Times, serif; padding: 0; margin: 0; color: #6E6E53; height: 100%; line-height: 1.5em; } a:link, a:visited, a:active { text-decoration: underline; color: #6E5256; } a:hover { text-decoration: none; color: #7F0A32; } #container { background: #000; width: 780px; margin:auto; padding: 0; text-align: justify; height: 100%; } #header { background-color: #FFF; width: 100%; height: 272px; margin: 0px; padding: 0px; border-left: 6px solid #6E5256; border-right: 6px solid #6E5256; } #nav { width: 100%; height: 32px; background: url(../images/nav/navLeftFade.jpg) #7F0A32 top left no-repeat; margin: 0px; padding: 0px; text-align: left; border-left: 6px solid #6E5256; border-right: 6px solid #6E5256; } #nav img { margin: 0px; padding: 0px; width: 126px; height: 32px; vertical-align: top; } #maincontent { background-color: #CAD49F; height: 100%; margin: 0px; padding: 0px; width: 100%; border-left: 6px solid #6E5256; border-right: 6px solid #6E5256; overflow: visible; } #mainLeftText { width: 350px; float: left; padding: 20px 0px 0px 10px; margin: 0; overflow: hidden; } #mainLeft { width: 320px; padding: 0px 0px 0px 30px; margin: 0; float:left; } #mainRight { width: 350px; float: right; padding: 50px 5px 0px 0px; margin: 0px; overflow: hidden; } .header { font-weight: bold; text-align: left; text-decoration: underline; margin-bottom: 0px; padding-bottom: 0px; } .spacer { clear: both; border: 1px solid; } /* NAVIGATION ROLLOVERS */ a#home:link, a#home:visited, a#home:active { margin-left: 150px; display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/home.gif); } a#home:hover { margin-left: 150px; background-position: -126px 0px; } a#services:link, a#services:visited, a#services:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/services.gif); } a#services:hover { background-position: -126px 0px; } a#gallery:link, a#gallery:visited, a#gallery:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/gallery.gif); } a#gallery:hover { background-position: -126px 0px; } a#testimonials:link, a#testimonials:visited, a#testimonials:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/testimonials.gif); } a#testimonials:hover { background-position: -126px 0px; } a#contact:link, a#contact:visited, a#contact:active { display: inline-block; width: 126px; height: 32px; text-decoration: none; background: url(../images/nav/contact.gif); } a#contact:hover { background-position: -126px 0px; } Thanks!... I'm trying to get a container div to stretch to the size of it's contents. Note, #navigation and #title will be for aesthetics only and aren't being used yet. Am I wrong in thinking that the clear has to go in the containing div, not the component divs? Anyway, I've tried both and neither works. I have: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>My Blog</title> </head> <body> <div id="title"> <!-- title --> </div> <div id="navigation"> <!-- search --> <!-- jumpbox --> <!-- subscription_and_rss_images --> </div> <div style="border:3px solid red; clear:both"> <div class="leftcolumn" style="border:3px solid green;"> <!-- menu --> <!-- leave this tag in for menu in Admin CP --> <!-- referrers --> <!-- photo --> <!-- calendar --> <!-- baby --> </div> <div class="rightcolumn" style="border:3px solid blue;"> <!-- content --> </div> </div> <div style="border:3px solid yellow;"> <!-- credit --> </div> </body> </html> And CSS: Code: div.leftcolumn{ float: left; width: 200px; } div.rightcolumn{ position: relative; margin-left: 205px; padding-left: 5px; border-left: 1px solid #222222; } This produces: I've got a div that incorporates some inline styling. Looks fine on a blank page, but when I insert it into a more complex page it inherits all the styling of the stylesheets. Is there anyway to I can have this div ignore all inherited styling and just format itself according to browser defaults and its own inline styling? I'm using float:left for my left nav bar, and then clear:both for my footer. Trouble is, I need to use some content boxes that will be using floats and then clears, however, when I use clear:both in my content box, it clears EVERYTHING (meaning it pushes below my navbar, because the navbar is quite long). Is there a workaround or am I using floats/clear wrong? TIA Javashackgirl Hello, Consider the following design: <div id="container"> <div id="A" class="A"></div> <div id="B" class="B"></div> </div> And the CSS classes: .A {float:left; clear:left} .B {float:left; clear:right} This does not work well. So I always do as follow: <div id="container"> <div id="A" class="A"></div> <div id="B" class="B"></div> <div id="clear" class="clear"></div> </div> Whe .A {clear:both} This always happens when I have divs inside other divs. Does anyone knows how to solve this? Thanks, Miguel This page works fine in Firefox, but in IE, the float makes the content move off the page to the left. I figured out that without a background-color applied to the .textBox style (which is the DIV that contains the text and image I am floating) it works. However, I really would like the .textBox to have a background color. Anybody knows what to do? Here is the page: http://www.jbbdesign.com/wip/index4.html many thanks, Julia I can't figure out how to clear the float for the columns with the text column 1 and 2. If the other columns dont have a lot of text then the footer defaults to just under the image so where that 1+2 start. Any ideas plase? Code: <div id="container"> <div id="home_col_1"> <img src="images/holder_slideshow.png" alt="" width="446" height="365" /> <div id="home_col_1_1"> column 1<br /> column 1<br /> column 1<br /> column 1<br /> column 1 </div> <div id="home_col_1_2"> <p> column 2</p> <p>column 2</p> <p>column 2</p> <p>column 2</p> <p>column 2</p> </div> </div> <div id="home_col_2"> <p>column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3<br /> column 3</p> </div> <div id="home_quicksearch"> Search Box Here </div> <div id="home_col_3"> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> <p>column 4</p> </div> <div id="home_col_4"> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> <p>column 5</p> </div> <div class="clear_floats"></div> </div> Code: #container { width: 986px; margin:0 auto; } #home_col_1 { width:446px; height:365px; float:left; } #home_col_1_1 { width:207px; float:left; padding:0 10px 0 0; border-right:#CECECE 1px solid; margin-top:10px; } #home_col_1_2 { width:207px; float:left; padding:0 10px 0 10px; border-right:#CECECE 1px solid; margin-top:10px; } #home_col_2 { width:171px; float:left; padding:10px 10px 0 10px; border-right:#CECECE 1px solid; } #home_col_3 { width:165px; float:left; padding:0 10px; border-right:#CECECE 1px solid; } #home_col_4 { width:142px; float:left; padding:0 10px; } #home_quicksearch { width:328px; padding:10px 10px 10px 0; float:left; border-bottom:#CECECE 1px solid; margin:0 0 10px 10px; background-color:#FFFFFF; } #footer { width: 966px; margin:0 auto; padding:10px; margin-top:10px; border-top:#CECECE 1px solid; } Hi i am trying to display small divs next to each other on one row, when i put clear left on the div that i want on the left, so that it puts it on the next line, the 3 divs then jump right down the page, putting a massive gap between this and the content above, is there a way to stop this happening? the code i have is html Code: <div id="arrow1">arrow1</div> <div id="arrow2">arrow2</div> <div id="arrow3">arrow3</div> Code: #arrow1 { background-image:url(images/arrow.gif) ; background-position:top left; background-repeat:no-repeat; width:176px; height:96px; float:left; display:inline; clear:left; } #arrow2 { background-image:url(images/arrow.gif) ; background-position:top left; background-repeat:no-repeat; width:176px; height:96px; float:left; display:inline; } #arrow3 { background-image:url(images/arrow.gif) ; background-position:top left; background-repeat:no-repeat; width:176px; height:96px; float:left; display:inline; } Hi, Im not sure whats going wrong with this, but I have two DIV elements on the page: 1st div "googleMap" CSS for googleMap: #googleMap { height: 300px; width: 500px; float: left; } 2nd div "page_right" CSS for page_right: #page_right { width: 300px; clear: left; float: right; } Could someone please tell me why page_right DIV is not clearing the googleMap div? I've just about had enough so hope some kind person will no the answer!! Here is the live page (showing the flaw): belvoir-mortgages.co.uk/contact.php Thanks Lee Does anyone know why the clear: left isn't working on firefox 1.0 on this page. Generic Page with floating divs and then clearing them for a new line. http://section31.us/temp/float_boxes.html Am I doing something wrong or is this a bug? In this header www.johnschureman.com I have an image, an h1 and a subtitle div. Code: <div id="header"> <img src="../images/jschu-crop150h.jpg"> <h1><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" >:<?php bloginfo('name'); ?></a></h1> <div id="subtitle"> <!-- Here's the tagline --> <?php bloginfo('description'); ?> </div> </div> I cannot figure out in my css how to make the subtitle appear below the h1. Code: #header { margin:0; padding:0; height:170px; padding: 0px; margin-top: 3px; /* padding-top:110px; padding-bottom:10px; padding-right:20px; padding-left:5px;*/ border-bottom: 1px solid #bab1b1; background: #404040; } #header img { float:left; display:inline; margin: 0 auto; padding: 10px 10px; border:none; } #header h1{ display: inline; float:right; padding:0px; margin: 0px; padding-top:100px; margin-bottom:3px; margin-right: 5px; font-size: 2.4em; letter-spacing:0.1em; } #subtitle { text-align:right; font-family:"Century Gothic", "Lucida Grande", "Lucida Sans Unicode", Verdana, Helvetica, Arial, sans-serif; margin-bottom:3px; margin-right: 5px; font-size: 0.9em; text-transform:uppercase; color:#bbb; } Hope this is enough info. I've been playing with clear, position, etc. Help? Thanks in advance. - Willi |