473,721 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested floated divs

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 any background
colour or image on the containing div will not be visible.

Now, suppose I put left and right padding on the containing div. How
come, if the containing div has collapsed, does the padding of the
container still apply to the two nested floated divs? It seems as though
the floated divs are 'inside' the container in some ways, but not inside
the container in other ways (they don't prop it up). Is there some
simple way to think of this so it all makes sense?
Oct 7 '07 #1
2 2180
On 2007-10-07, Ben C. <be*@example.ne twrote:
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 any background
colour or image on the containing div will not be visible.

Now, suppose I put left and right padding on the containing div. How
come, if the containing div has collapsed, does the padding of the
container still apply to the two nested floated divs?
The container still has all its padding. Its top, left and right padding
will be above, to the left and to the right of the floats inside.

It's just that its auto height calculation (if it has auto height)
doesn't take account of the floats.
It seems as though the floated divs are 'inside' the container in some
ways, but not inside the container in other ways (they don't prop it
up). Is there some simple way to think of this so it all makes sense?
The explanation you've given is OK-- they start inside but end outside.
Oct 7 '07 #2
In article <5m************ @mid.individual .net>,
"Ben C." <be*@example.ne twrote:
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 any background
colour or image on the containing div will not be visible.

Now, suppose I put left and right padding on the containing div. How
come, if the containing div has collapsed, does the padding of the
container still apply to the two nested floated divs? It seems as though
the floated divs are 'inside' the container in some ways, but not inside
the container in other ways (they don't prop it up). Is there some
simple way to think of this so it all makes sense?
Well you could think of it this way:

<http://tinyurl.com/2wktfv>

--
dorayme
Oct 8 '07 #3

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

Similar topics

6
2562
by: Zaka Ferenc | last post by:
Hi all, the page http://info.etr.elte.hu/divtest5.html looks as I expected in IE6 and Opera 7.11, but the floated divs float out of the containing blocks (divs) in NN7.1 and Opera 7.0 (what I don't want). Questions are: 1) IE & Opera7.11 or NN & Opera7.0 display correctly the page ? 2) If IE & Opera7.11 work well is there a workaround for NN & Opera7.0 ? 3) If NN & Opera7.0 are the correct ones how can I make this page to look the...
9
4075
by: Dustin | last post by:
Here's what I am trying to do: (Names represent CSS classes.) I want to create a photo gallery. I want the entire gallery to be surrounded by a box named PhotoGallery. I want a fluid placement of the individual Items within PhotoGallery. An Item is a box that has two child boxes, PhotoBox and Caption. Photobox has an explicit width and height. PhotoBox contains an image whose dimensions may vary, but are constrained to be within...
3
5009
by: Philip | last post by:
I am trying to make a bunched of left-floated divs that will be contained in a larger div. the floated divs all contain a left-floated img and text of varying sizes. If I don't set a height (or height:auto) the larger div doesn't seem to see the nested divs, and they spill out the bottom. IE seems to automatically resize the larger div as long as I set the height to 100% or any pixel size. Mozilla doesn't recognize the percent, and...
7
17332
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 not resize at all. How come? HTML <div id="ads">
2
8283
by: tasman.hayes | last post by:
I'm experimenting with converting a site from a table layout to CSS. I'm floating three DIVs in a row for the top of a website (a logo, navigation buttons and a email list signup box). The DIVs have a grey background. When I view the page in Firefox, I get what I hoped for: there is a solid grey rectangle at the top of the website. When I view the page in Internet Explorer 6 (WinXP), there is a gap between two right hand DIVs (i.e. a...
1
1354
by: alex | last post by:
Hey all, May have missed this in the FAQ, advice or article links welcome. Have a content div with a navigation div floated left and an advertisement div floated right. I would like to have a border going around the content, the two divs and right down to the bottom. So far, all I've got is this:
4
1473
by: D | last post by:
Hi, I've been toying around with master pages and am trying to set up your standard banner across the top and 3 areas below that, left content, center content and right content. I have the banner part being the top level master page and the left content be nested master page named subMaster.master. In this I have 3 div's that I've named
10
2860
by: crazeway | last post by:
The top margin of a nested div (#main) is pulling down its containing div (#middle) along with the 2 floated divs flanking it. This problem corrects itself and gives me the desired effect if I add a border to #middle. However I'd like to understand the problem and do away with the border. Here is a test page I made to illustrate my problem <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"...
7
1462
by: Ed Jay | last post by:
I have two divs. The left div is floated left and the right div is floated right. If the left div contains a single line, the left and right divs are on the same line (obviously). But...the left div content is dynamic and its content can occupy two or three lines, When it contains more than one line, the right div is positioned on the top line of the left div content. I need (want) it to be positioned on the last (lowest) line of the left...
0
8851
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8736
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9373
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6676
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5992
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2587
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2137
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.