By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,493 Members | 1,936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,493 IT Pros & Developers. It's quick & easy.

Floating divs in divs

P: n/a
As soon as I float anything in a div, it is no longer held within the
div anymore. I'd like to be able to float things relative to the
element that they are contained in. Is this even possible in CSS?

I'm a table based designer from way back, so maybe this is just the
wrong approach to CSS. If this isn't actually possible, would someone
be able to tell me what I can do instead?

I don't really want to use absolute positioning because I want my
designs to be resizable.

Helen
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
he***@helephant.com (Helen) wrote:
As soon as I float anything in a div, it is no longer held within the
div anymore.
That's correct as per the CSS specs.
I'd like to be able to float things relative to the
element that they are contained in. Is this even possible in CSS?
Add another element with the clear property set after the floated
element but before the end of the parent.

<div>
<div style="float: left;"></div>
<div style="clear: left;"></div>
</div>

The height of the parent is now extended so that it encompasses the
floated child.
I don't really want to use absolute positioning because I want my
designs to be resizable.


Good move.

cheers,
Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2

P: n/a

Hi Helen,

You should read Eric Meyer's excellent article on this topic:
CONTAINING FLOAT
http://tinyurl.com/369n3

Helen wrote:
*As soon as I float anything in a div, it is no longer held withi
the
div anymore. I'd like to be able to float things relative to the
element that they are contained in. Is this even possible in CSS?

I'm a table based designer from way back, so maybe this is just the
wrong approach to CSS. If this isn't actually possible, woul
someone
be able to tell me what I can do instead?

I don't really want to use absolute positioning because I want my
designs to be resizable.

Helen


Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message43462.htm

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.