473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Clearing floats to make enclosing DIV expand: problem

While noodling around, looking for a good layout for an "events calendar"
page, I came upon a problem that has me stymied.

Have a look at http://kpuc.org/events/upcoming-2.html .

The basic structure of each event is:

Event div
Left-floated image
Event header div
Left-floated div (clever "calendar-style" date)
Event title and time
Event description

(For debugging purposes, the Event div has a white background, and the Event
header div has a grey border.)

I eventually want to simulate a 2-column layout inside each event div: image
on the left, everything else neatly lined up off the image's right side. I
can't even get that far, because a problem wreaks havoc with the event
header.

Some background:

Since floats are not part of the document flow, if you want to ensure that
an enclosing div is at least as tall as the float, you typically end the div
with a dummy "clearer" div:

<div class="FlowFloat">&nbsp;</div>
</div>

and set the "clearer" div to "clear:both", with additional CSS to make it
invisible, yet have a presence in the document flow. (See
http://www.complexspiral.com/publica...aining-floats/ for a
demonstration) If the enclosing div's content is shorter than the float it
contains, the "clearer" will force the div to expand to the desired height.

Now on to the problem:

If I use a "clearer" div inside the event header to ensure that the header
is at least as tall as the "calendar-style" date, the "clearer" div is
correctly positioned below the date, about halfway down the floated image
outside the event header. (I can verify this by using Mozilla DOM Inspector,
which will flash a border around any element, even my insivible "clearer"
div.)

Unfortunately, as shown by the grey border, the event header expands
*beyond* the "clearer" div -- the bottom of the event header is next to the
bottom of the floated image *outside* the header.

I can't make heads or tails of this. The event header ends with the
"clearer" div, so why should it end onscreen quite a ways below the
"clearer"?

Thanks for your help.

Jul 20 '05 #1
0 5020

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

Similar topics

18
8061
by: Niels | last post by:
Hi group, I have some problems with clearing floated divs. My usual method works fine in Konqueror, but not in Firefox. Here's an example: <html><body> <div id='left' style='float:left;...
6
3628
by: Michael Rozdoba | last post by:
I want to set a background colour on one level of headings, but have their width span only the text & a small amount of padding. I was styling display to inline to achieve this. Then I...
4
2393
by: LB | last post by:
Apologies if this sounds like a very newbie question. I'm putting together a 3 column layout at the moment, the left 2 columns are effectively menus and the third one is the 'content'. Now,...
8
2459
by: Tom | last post by:
Has anyone ever seen a IComparer for floats the returns magnitude. i.e. instead of returning -1, it would return -5. To let you know HOW different the two numbers are. obviously for int it is a -...
12
5587
by: BGP | last post by:
I am working on a WIN32 API app using devc++4992 that will accept Dow Jones/NASDAQ/etc. stock prices as input, parse them, and do things with it. The user can just cut and paste back prices into a...
2
2284
by: Andrey Tarasevich | last post by:
Hello Consider the following HTML code sketch <div> <img src="..." style="float: left"> <p>Paragraph text</p> </div> <hr>
44
2619
by: Kosio | last post by:
-Hello, I'm looking for a way to deconstruct a (32 bit) float value to four (8 bit) char values. I then need a way to take those four (8 bit) char values and construct a (32 bit) float value. ...
0
1733
by: Simon Dean | last post by:
Hi, Before I get to far, I've been making some modifications, but I need to make sure Im on the right track. Here's what I have so far: http://celebrity.blargle.co.uk/test2.html Well...
13
2319
by: yb | last post by:
Hi, Is there a CSS method to clear a float such that it aligns with the left content edge. For example: X X X X X X X X
0
7223
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
7314
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
7372
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...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
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,...
1
5041
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.