473,386 Members | 1,752 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.

"float" property problem...

hi,

here,
http://www.mayacove.com/design/sd/test2.html

<div class="entry"has a bottom-margin of 20px.. but it's ignored if
divs inside it have "float" property.. (put borders around divs for
testing purposes.. just like in my previous post, HTML and CSS both
validate..)
thank you...
Jun 27 '08 #1
5 1932
maya wrote:
hi,

here,
http://www.mayacove.com/design/sd/test2.html

<div class="entry"has a bottom-margin of 20px.. but it's ignored if
divs inside it have "float" property.. (put borders around divs for
testing purposes.. just like in my previous post, HTML and CSS both
validate..)
It isn't ignored. There are 20 pixels between the two entry boxes.

I think you're being confused by a couple of things. First, are you
aware of the difference between margin and padding? Margin is what's
outside the border (when there's a border), between the border and
neighboring elements. Padding is what's inside the border, between the
border and the content.

Besides that, I think you're not aware of everything involved in using
floats. In particular, floats don't occupy vertical space in their
containing element. The entry box that contains your two floats ends
right after it begins, and not beneath the two floats. The second entry
begins more or less at the top of the two floats. The only reason that
isn't obvious is that your floats have width 305 and you have them
constrained in a 630-pixel-wide table. Try removing the width on the
table and widening your browser to much more than 630 pixels and see
what happens--see where the first "attendee" headline appears.

Look for information on floats as well as on the CSS clear attribute at

http://www.w3.org/TR/CSS21/visuren.html#floats
Jun 27 '08 #2
Harlan Messinger wrote:
maya wrote:
>hi,

here,
http://www.mayacove.com/design/sd/test2.html

<div class="entry"has a bottom-margin of 20px.. but it's ignored if
divs inside it have "float" property.. (put borders around divs for
testing purposes.. just like in my previous post, HTML and CSS both
validate..)

It isn't ignored. There are 20 pixels between the two entry boxes.

I think you're being confused by a couple of things. First, are you
aware of the difference between margin and padding? Margin is what's
outside the border (when there's a border), between the border and
neighboring elements. Padding is what's inside the border, between the
border and the content.

Besides that, I think you're not aware of everything involved in using
floats. In particular, floats don't occupy vertical space in their
containing element. The entry box that contains your two floats ends
right after it begins, and not beneath the two floats. The second entry
begins more or less at the top of the two floats. The only reason that
isn't obvious is that your floats have width 305 and you have them
constrained in a 630-pixel-wide table. Try removing the width on the
table and widening your browser to much more than 630 pixels and see
what happens--see where the first "attendee" headline appears.

Look for information on floats as well as on the CSS clear attribute at

http://www.w3.org/TR/CSS21/visuren.html#floats
oh brother.. thank you Harlan....

personally for layouts I prefer using tables to do the main grid of the
layout, then maybe inside put divs; but where I work most folks prefer
div-based layouts, so I always make an effort, but I always end up
getting in trouble as soon as I try something a bit more complex..

I do know difference between padding and margin.. problem is that
recently I found out that padding, if you use it inside a <td>, it ADDS
to the width of the <td(not sure if this also happens with divs..) so
now am trying to use padding as little as possible..

(I tried both bottom-padding and bottom-margin with this one, neither
one worked.. also tried using "clear" property, also didn't work...)

thank you again..


Jun 27 '08 #3
maya wrote:
Harlan Messinger wrote:
>maya wrote:
>>hi,

here,
http://www.mayacove.com/design/sd/test2.html

<div class="entry"has a bottom-margin of 20px.. but it's ignored if
divs inside it have "float" property.. (put borders around divs for
testing purposes.. just like in my previous post, HTML and CSS both
validate..)

It isn't ignored. There are 20 pixels between the two entry boxes.

I think you're being confused by a couple of things. First, are you
aware of the difference between margin and padding? Margin is what's
outside the border (when there's a border), between the border and
neighboring elements. Padding is what's inside the border, between the
border and the content.

Besides that, I think you're not aware of everything involved in using
floats. In particular, floats don't occupy vertical space in their
containing element. The entry box that contains your two floats ends
right after it begins, and not beneath the two floats. The second
entry begins more or less at the top of the two floats. The only
reason that isn't obvious is that your floats have width 305 and you
have them constrained in a 630-pixel-wide table. Try removing the
width on the table and widening your browser to much more than 630
pixels and see what happens--see where the first "attendee" headline
appears.

Look for information on floats as well as on the CSS clear attribute at

http://www.w3.org/TR/CSS21/visuren.html#floats

oh brother.. thank you Harlan....

personally for layouts I prefer using tables to do the main grid of the
layout, then maybe inside put divs; but where I work most folks prefer
div-based layouts, so I always make an effort, but I always end up
getting in trouble as soon as I try something a bit more complex..

I do know difference between padding and margin.. problem is that
recently I found out that padding, if you use it inside a <td>, it ADDS
to the width of the <td(not sure if this also happens with divs..) so
now am trying to use padding as little as possible..
Hmm? Padding-bottom and padding-top shouldn't have any effect at all on
the cell's width.
(I tried both bottom-padding and bottom-margin with this one, neither
one worked.. also tried using "clear" property, also didn't work...)
Well--as I tried to suggest before, you may not be seeing it "work"
because you're misinterpreting which of the borders belongs to each of
the elements. And as I noted, there IS a 20px gap between pairs of
borders, the work of your margin-bottom, so if you think it isn't
working, then you may be expecting something else.

For the sake of illustration, try creating THREE classes--entry1,
entry2, and entry3--with the same properties set for each, except with a
different border color, and set border instead of just border-top, so
you can see which DIV is which on your page.
Jun 27 '08 #4
In article <48********@news.x-privat.org>, maya <ma********@yahoo.com>
wrote:
hi,

here,
http://www.mayacove.com/design/sd/test2.html

<div class="entry"has a bottom-margin of 20px.. but it's ignored if
divs inside it have "float" property.. (put borders around divs for
testing purposes.. just like in my previous post, HTML and CSS both
validate..)

Perhaps you would find

<http://netweaver.com.au/floatHouse/>

helpful.

--
dorayme
Jun 27 '08 #5

maya wrote:
>>>
http://www.mayacove.com/design/sd/test2.html

personally for layouts I prefer using tables to do the main grid of the
layout, then maybe inside put divs; but where I work most folks prefer
div-based layouts, so I always make an effort, but I always end up
getting in trouble as soon as I try something a bit more complex..
After all the times you've posted here in the past few months, and all
the tutorials, articles and advice you've been given, it seems you still
haven't learned anything.

You'll forever be hacking away unsuccessfully and getting frustrated
with your failures unless you take the time to *learn* this stuff. Buy a
book or 3 and read them. For quick online resources, start here:
http://brainjar.com/css/positioning/
http://www.htmldog.com/

Read up on collapsing margins, too. The subject has come up here
numerous times so you should find all the info you could ever want in
the group archives.

Get rid of the impending div-itis while you're at it:
http://microformats.org/wiki/posh
recently I found out that padding, if you use it inside a <td>, it ADDS
to the width of the <td(not sure if this also happens with divs..)
If you understood the CSS box model, you would know the answer to that.

--
Berg
Jun 27 '08 #6

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

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
6
by: asmirnov1234567890 | last post by:
Hi my python 2.3.4 for windows refuse to execute line float("NaN"). It says: >>> float("NaN") Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: invalid literal for...
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"...
2
by: pango | last post by:
I write below code in my program: float f=0.371f; int i=(int)(f*1000.0f); I think the result of "i" should be "371",but in fact it is "370",why?How to solve it?
8
by: Manuel | last post by:
Anyone know why for openGL applications must be used GLfloat (and GLint, etc...) instead float, int, etc..? thx, Manuel
5
by: Peter Hansen | last post by:
I'm investigating a puzzling problem involving an attempt to generate a constant containing an (IEEE 754) "infinity" value. (I understand that special float values are a "platform-dependent...
16
by: chandanlinster | last post by:
As far as I know floating point variables, that are declared as float follow IEEE format representation (which is 32-bit in size). But chapter1-page no 9 of the book "The C programming language"...
29
by: candy_init | last post by:
Hi all, I just came across the following program: #include <stdio.h> int main() { float a = 12.5; printf("%d\n", a); printf("%d\n", *(int *)&a); return 0;
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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
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.