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
https://forums.phpfreaks.com/topic/156953-simple-float/
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
https://forums.phpfreaks.com/topic/156953-simple-float/#findComment-826879
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
https://forums.phpfreaks.com/topic/156953-simple-float/#findComment-827121
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.