473,412 Members | 5,361 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,412 software developers and data experts.

I can't quite seem to grasp floats.

http://foomanchu.com/understanding_floats.htm

In this example, I don't understand why the UL drops out of the bottom
of the DIV.

I've read over the float section in the "visual formatting model" area a
few times, but I simply don't know what's going on here.

Is there perhaps a simpler float tutorial out there, or would anyone
like to dumb it down for me?

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jul 8 '07 #1
6 1616
rf

"-Lost" <ma****************@techie.comwrote in message
news:gs******************************@comcast.com. ..
http://foomanchu.com/understanding_floats.htm

In this example, I don't understand why the UL drops out of the bottom of
the DIV.
It doesn't. The ul is still firmly inside the div. That's why the div is
still about 1 em high, the top margin of the ul is stopping it from
collapsing any further.

What you have done, as far as layout is concerned, is to remove each li. The
only content left in the div is a zero height ul(1) so of course it will
collapse as per your example, limited by the margin on the ul.

(1) The ul no longer has any content (for layout purposes) and so it has
callapsed to zero height.

After all that is done, each li is put back (floated left) exactly where
they would have been if they weren't floated: a ul margin-top down from the
top of the div.

--
Richard.
Jul 8 '07 #2
In article <ub*****************@news-server.bigpond.net.au>,
"rf" <rf@invalid.comwrote:
"-Lost" <ma****************@techie.comwrote in message
news:gs******************************@comcast.com. ..
http://foomanchu.com/understanding_floats.htm

In this example, I don't understand why the UL drops out of the bottom of
the DIV.

It doesn't. The ul is still firmly inside the div. That's why the div is
still about 1 em high, the top margin of the ul is stopping it from
collapsing any further.

What you have done, as far as layout is concerned, is to remove each li. The
only content left in the div is a zero height ul(1) so of course it will
collapse as per your example, limited by the margin on the ul.

(1) The ul no longer has any content (for layout purposes) and so it has
callapsed to zero height.

After all that is done, each li is put back (floated left) exactly where
they would have been if they weren't floated: a ul margin-top down from the
top of the div.
At least the _first item_ is so put back. To see this, try

<li id="noFloat">Item 1</li>

and css:

li#noFloat {float:none}

OP is using the floating to horizontalize the list items, if all
of them are float deprived, they go back different.

<li id="noFloat">Item 1</li>
<li id="noFloat">Item 2</li>
<li id="noFloat">Item 3</li>
<li id="noFloat">Item 4</li>

But rf's points are good. OP might try putting a little content
in to see it; eg. a character just after the </ulor even give
the div any reasonable height (at least in FF).

(hey...rf... you see how I know _some_ big words: horizontalize)

--
dorayme
Jul 8 '07 #3
rf wrote:
"-Lost" <ma****************@techie.comwrote in message
news:gs******************************@comcast.com. ..
>http://foomanchu.com/understanding_floats.htm

In this example, I don't understand why the UL drops out of the bottom of
the DIV.

It doesn't. The ul is still firmly inside the div. That's why the div is
still about 1 em high, the top margin of the ul is stopping it from
collapsing any further.

What you have done, as far as layout is concerned, is to remove each li. The
only content left in the div is a zero height ul(1) so of course it will
collapse as per your example, limited by the margin on the ul.

(1) The ul no longer has any content (for layout purposes) and so it has
callapsed to zero height.

After all that is done, each li is put back (floated left) exactly where
they would have been if they weren't floated: a ul margin-top down from the
top of the div.
OK, 2 things then. The first being, based on the assumption I am
understanding this correctly.

1. So all that is needed is to provide the UL some height

2. You understanding of this is based in whole on a reading of the CSS
specification at W3C? Or is there perhaps another site, article, or
series of articles that can explain it as you have done?

Many thanks, rf.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jul 8 '07 #4
In article <ym****************@news-server.bigpond.net.au>,
"rf" <rf@invalid.comwrote:
dorayme gets this a bit wrong by saying that only the _first item_ is put
back at the vertical position it would have had. She considered the entire
page as a whole, before any floating was done. Floats don't work that way.
Consider it like this:
Not sure this bit is something it got wrong? It was a complicated
context. It was basically supporting most of what rf was saying.
(1) The ul no longer has any content (for layout purposes) and so it has
callapsed to zero height.

After all that is done, each li is put back (floated left) exactly where
they would have been if they weren't floated: a ul margin-top down from the
top of the div.
On the page as seen, at least the _first item_ is so put back. To
see this, it said to try

<li id="noFloat">Item 1</li>

and css:

li#noFloat {float:none}

OP is using the floating to horizontalize the list items, if all
of them are float deprived, they go back different (not to
"exactly where they would have been if they weren't floated")

<li id="noFloat">Item 1</li>
<li id="noFloat">Item 2</li>
<li id="noFloat">Item 3</li>
<li id="noFloat">Item 4</li>

It thought rf's explanations good and menschful. It was a small
detail. Anyway, it has to get back to thinking hard about yogurt.

--
dorayme
Jul 8 '07 #5
-Lost wrote:
>
Is there perhaps a simpler float tutorial out there
http://brainjar.com/css/positioning/

--
Berg
Jul 9 '07 #6
Bergamot wrote:
-Lost wrote:
>Is there perhaps a simpler float tutorial out there

http://brainjar.com/css/positioning/
Many thanks.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jul 9 '07 #7

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

Similar topics

50
by: dataangel | last post by:
I wrote a function to compare whether two strings are "similar" because I'm using python to make a small text adventure engine and I want to it to be responsive to slight mispellings, like...
5
by: geskerrett | last post by:
We are working on a project to decipher a record structure of an old accounting system that originates from the late80's mid-90's. We have come across a number format that appears to be a "float"...
8
by: Madhusudan Singh | last post by:
Is it possible to convert a very long list of strings to a list of floats in a single statement ? I have tried float(x) and float(x) but neither work. I guess I would have to write a loop if...
5
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
18
by: strchild | last post by:
Hey Guys, I've been perusing the newsgroup here for some time now, and going through my ever so non-helpful book, Microsoft Visual Basic .NET Step by Step Version 2003, over and over, and I feel...
14
by: Melanie Avids | last post by:
Hi, I'm tired of banging my head on the computer. I'm hoping someone can help? I have a very small simple page that looks perfect in Firefox, Safari, and Netscape. It's clean. The HTML and CSS both...
50
by: Dave Rado | last post by:
Hi I've created a banner with a drop-shadow using a div - there's a mock- up at http://tinyurl.com/6n7czu . The only problem is that the way I've done it, I have to specify the width of the div...
1
by: donpro | last post by:
https://testbed.odysseyshipping.com/index.php This is driving me nuts. I've spent much time trying to style this page footer but because I cannot set widths using "display: inline". I've tried...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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
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,...
0
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
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...

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.