Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Postioning problem (stuck again)...argh!

Featured Replies

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 :give_rose:

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.

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.