Jump to content

simple float??


dadamssg

Recommended Posts

i have a content div and then a box div that lies within the content div. Its a small square that i want to float right. I also want the text within the content div to wrap around the square...whats happening now is the text goes to the very top of the content div and just pushes the square(thats suppose to be in the top right corner of the content div) down. The words won't hit the square and start a new line...im confused

 

html

<div id="content">
	 d;lkasjg;lksajd lkfj as;lkjf salkjf dsa;lkfja flaj f;lkajs f;lksajdf ;lksajf s;lkjf s;lkfjs af;lkjsa f;lksajf ;ls
akjf sa;lkdjf sad;lkjf sa;lkjsa f;lkjsa f;lkdsajf dsa;lkjf 
	   <div id="rightcolumn">

	 </div>
	 </div>

 

css

#content
{
border: px solid #F8FFE6;
width: 1090px;
height: 700PX;
margin-top: 10px;
margin-bottom: 10px;
background-color: #FFF;
float: left;
clear: left;
padding-right: 10px;
}

#rightcolumn
{
margin-top: 10px;
float: right;
background-color: #562F32;
width: 345px;
height: 270px;
}

Link to comment
Share on other sites

1) Move the right column div to be the first child the parent div. So push it above the text.

 

2) You need to clear your floats. Add overflow: auto; in the parent div's css.

 

3) Display: block; does not need to be stated. A floated div automatically inherits display: block;

 

4) Add content in the right column div. There isn't anything in there at the moment.

Link to comment
Share on other sites

hey thanks that helped...what exactly does the overlow part do?

 

Overflow: auto; clears your float. A floated div is partly taken out of the flow of the content. I say partly because it pushes things down, but past the parent div, things would "ignore" the div. Is pretty complicated, but once you start floating divs all over the place you'll know exactly what I mean.

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.