Jump to content

Can you float a div and have text flow around it?


Spawny

Recommended Posts

Hi All,i'm trying to float a div box to the right inside another div. I'd like the text inside the 'centrecontent' div to flow around the 'carpbox' div. Is this possible?CSS

.centrecontent{position: absolute;float:left;background:#fafafa;overflow: visible;top: 0px; left:15%; height: 100%; width: 62%;min-height:100%;font-size: 10pt; color: black;line-height: 16pt;padding: 5px 40px;text-align: left; font-family: Verdana,Tahoma,sans-serif;border: thin 1px black;margin-bottom:2px;}html>body .centrecontent{height:auto;}.carpbox {	position: absolute;	float: right;	border-style: solid;	border-width:2px;	background-color: darkkhaki;	border-color:#000000;	top: 10%; left: 50%; height: 250px; width: 300px;	padding:10px;	}

I then just enclose the carpbox div inside the centrecontent div. The problem is that it doesn't flow, and the carpbox div sits on top of the text.I intend to put RSS feeds in the carpbox div eventually.

Link to comment
Share on other sites

Is this what you need?

<html><head><style type="text/css">#main{ border:5px solid green; padding:2px;}#one{ float:right; width:20%; color:red; border:5px solid blue;}</style></head><body><div id="main"><div id="one">hi how are you, i am at the right hand side of the main div</div>This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.</div></body></html>

Link to comment
Share on other sites

Thanks for that Scott, its exactly what i need, and works fine on your page, but when i try to do this on my page, it still defaults to the text behind the div. It seems to be ignoring the float.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...