Jump to content

content appearing under main div problem


ukscotth

Recommended Posts

Hi all,

 

Im new to css and im having a problem. The content i place in the left and right divs is appearing under the main div. Can anyone see what Im doing wrong ?

 

 



#win_body {
border: 1px solid #BDC7D8;

}

#win_half_left {
float:left;

} 

#win_half_right {
float:right;

} 

#clearfix{
clear:both;

}

Many thanks,

 

Scott

Link to comment
Share on other sites

Hi, I've tried it with different widths, margings and paddings and the content still appears underneath for some reason. Yep checked to make sure all the tags are closed.

 

it does it even when I use this :

 



<div id = "win_body">
<div id ="win_half_left">
		test content
</div>

<div id ="win_half_right">
		test content
</div>
</div>

Link to comment
Share on other sites

How can the content appear under the main div when the left & right columns are included in the main div? (talking joe average css of course, none of the float or neg margin stuff)

 

When I have problems sometimes I add color and/or borders to get a better feel of the lay out.

 

Try this

 

#win_body {

border: 1px solid #BDC7D8;

height: 500px;

width: 500px;

background-color: #eeeeee;

margin: 0 auto;

}

#win_half_left {float:left; background-color: red;}

#win_half_right {float:right; background-color: yellow;}

#clearfix{

clear:both;}

 

Then take out the height to see what happens.

 

Then take out the width to see what happens.

 

Then float the main div to the left and see what happens.

 

This happens all the time, you can cure it by adding another div to contain your left and right columns and float it or you can add a brake under the the left and right divs but before the closing main div like I do sometimes like this <br class="clear" /> and style it .clear{clear: both;} The only problem with the last one is that it adds height that you may not want to be there.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.