July 20, 200818 yr Hiya, How can I make a DIV postion under the first row of DIV's? let me explain a little I've got a photoshop Layout that I'm trying to code I have a banner space then four menu buttons under it then UNDERthat I have three divs for the main body but the far left image is just hanging to the right of my far right menu button.??? Heres my code: .banner { height: 205px; width: 1000px; background-image: url(images/bannertop.png); } /************************************************** ****************MAIN MENU DIVS************** **************************************************/ .home { float: left; height: 112px; width: 307px; background-image: url(images/home.png); } .about { float: left; height: 112px; width: 218px; background-image: url(images/aboutus.png); } .services { float: left; height: 112px; width: 250px; background-image: url(images/services.png); } .contactus { float: left; height: 112px; width: 225px; background-image: url(images/contactus.png); } /************************************************** ****************MAIN BODY DIVS************** **************************************************/ [i].bodyfarleft { float: left; height: 672px; width: 52px; background-image: url(images/bodyfarleft.png);[/i] } so the body far left should be positioned under the home DIV here my HTML <!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> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="banner"></div> <div class="home"></div> <div class="about"></div> <div class="services"></div> <div class="contactus"></div> <div class="bodyfarleft"></div> </body> </html> I hope this makes sense... Thanks very much
July 20, 200818 yr Everything should be done in twos.. so you have a left wrapper with 2 divs inside that and a right wrapper with 2 divs inside that. In total there are 6 divs but the parent boxes total 2. This is why the clear CSS property was introduced. So to get your divs to stack. You simple use #div { clear: both; } If there was only one div you had to clear you could use #div { clear: left (or right); } Hope this helps.
July 20, 200818 yr Author Like this... .home { float: left; height: 112px; width: 307px; background-image: url(images/home.png); } .about { float: left; height: 112px; width: 218px; background-image: url(images/aboutus.png); } .services { float: left; height: 112px; width: 250px; background-image: url(images/services.png); } .contactus { float: left; height: 112px; width: 225px; background-image: url(images/contactus.png); } /************************************************** ****************MAIN BODY DIVS************** **************************************************/ .leftcontainer { float:left; height:112px; width:525; } .rightcontainer { float:left; height:112px; width:475; } .bodyfarleft { float: left; clear: left; height: 672px; width: 52px; background-image: url(images/bodyfarleft.png); } <!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> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="banner"></div> <div class="leftcontainer"> <div class="home"></div> <div class="about"></div></div> <div class="rightcontainer"> <div class="services"></div> <div class="contactus"></div></div> <div class="bodyfarleft"></div> </body> </html> Its worked anywho...Thanks v much...
Create an account or sign in to comment