473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Nested float that resizes container?

I'm new to CSS and am trying to figure out how to have create the
following layout that I could easily do with tables.

I have a container that has some copy in it in a div and another div
that I float that contains an image. Everything works great when I have
a lot of text as it wraps around the image properly as below (hope this
shows up.)

------------------------------------------------------
| ----------------------- |
| | | Lorem ipsum dolor sit |
| | | consectetur adipisici |
| | | elit, sed do eiusmod |
| ----------------------- incididunt ut labore et |
| dolore magna aliqua. Ut enim ad minim |
------------------------------------------------------

This page is set up so that these sections are generated dynamically.
The problem arises when there is less copy that what is shown above.
The nested div with the image extends past the border of the the
container where the text is. Looking something like this.

------------------------------------------------------
| ----------------------- |
| | | Lorem ipsum dolor sit |
|-| | -------------------------
| |
| |
-----------------------

What I want is for the container to always be at least as large as the
floating div inside of it, regardless of the amount of copy contained.

How do I do this?

Feb 7 '06 #1
1 1389

engwar wrote:
What I want is for the container to always be at least as large as the
floating div inside of it, regardless of the amount of copy contained.

How do I do this?


Have an element with the style property clear: both; set, after the end
of the content but before the end of the container. This will extend
the height of the container to after any floated children.

Steve

Feb 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jonah Bishop | last post by:
I have a puzzling problem with centering text, and I'm hoping that someone here can help me out. First of all, let me state that I am using XHTML 1.0 Strict and CSS for all layout purposes (no...
7
by: Gnolen | last post by:
Hi, I have a problem with float in firefox/mozilla, the 'ads'-div doesn't resize on the height with the 'ads_left' and 'ads_right'. In IE there is no problem but in FF there is. The 'ads'-div do...
8
by: CoolPint | last post by:
I read in books that nested class cannot access private members of nesting class and vice versa unless they are made friends. Somehow, my compiler is letting my nested class member functions access...
0
by: gauravkg via DotNetMonster.com | last post by:
Problem : I have a nested repeater in which i am showing data through table | title | | description | | title | | description | on load the description is hidden...
2
by: Ben C. | last post by:
Hi If I have a container div and inside the container div I float two divs (one left and one right), the containting div will collapse as the floated divs will no longer prop it up, meaning that...
8
by: Sheldon | last post by:
Hi, Can anyone help with this problem with setting up nested structures and initializing them for use. I have created several structs and placed them in a super struct that I will then pass to...
2
by: Ben C | last post by:
On 2008-04-08, Gus Richter <gusrichter@netscape.netwrote: Sometimes 0,0 of more than one container blocks occupy the same pixel on the screen, so this is not a good criterion. body float div...
2
by: David | last post by:
I'm trying to style a kind of minimalist welcome page where each of X number of (gray?) boxes will be links to a part of the site. I want to implement the navbar (ie, set of boxes linking to...
2
bugboy
by: bugboy | last post by:
I'm building an interface like "column view" on a mac. I have nested <div> columns inside another <div> container which is set to 57% width of page. The nested div's act as columns which are...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.