HighDots Forums  

Strange cross linking of div heights.

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Strange cross linking of div heights. in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alan Chandler
 
Posts: n/a

Default Strange cross linking of div heights. - 09-16-2005 , 03:26 PM






Earlier in the week I posted a problem with the height of a div in the
first row of a table I was constructing using tapestry as an the engine
generating the html. This problem was across a range of browsers.

Nobody was able to help me because I couldn't post a URL

I have managed to isolate the problem in some static html, but I don't
understand why it occurs.

The following two url's illustrate it.

http://www.chandlerfamily.org.uk/famtree/test.html

shows what I am trying to achieve, but without a left hand panel.

Adding in the left hand panel somehow interacts with an internal div of
the right hand panel - see

http://www.chandlerfamily.org.uk/famtree/test2.html

which shows the bottom of the nested internal div (of class "spouse")
somehow interacting with the bottom of div #menuapps.

This is causing the first div of class spouse to somehow be extended.

The only possible linkage that I can see is through the clearfix class,
but I don't understand why. Can someone give me an explanation so that
I can have a clue as how to avoid it.

Thanks.

(css is at http://www.chandlerfamily.org.uk/famtree/chandler.css )


Reply With Quote
  #2  
Old   
Jim Moe
 
Posts: n/a

Default Re: Strange cross linking of div heights. - 09-16-2005 , 10:24 PM






Alan Chandler wrote:
Quote:
I have managed to isolate the problem in some static html, but I don't
understand why it occurs.

The "clearfix" class did not really address the problem. Remove all of
the "clearfix" classes. They are useless for your example.
The difficulty you are having is that you float:left nearly everything
in a "family" div, leaving the div with essentially no content. Thus the
div height collapses to a minimum value determined by padding and margin.
The same thing occurs for non-floated divs that do not have any content.

Add   to each div that does not have any content besides other
floated divs, or non-floated divs (e.g., "children") with no content.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
  #3  
Old   
Alan Chandler
 
Posts: n/a

Default Re: Strange cross linking of div heights. - 09-17-2005 , 03:44 AM



Jim Moe wrote:
Quote:
Alan Chandler wrote:


I have managed to isolate the problem in some static html, but I don't
understand why it occurs.

The "clearfix" class did not really address the problem. Remove all of
the "clearfix" classes. They are useless for your example.
The difficulty you are having is that you float:left nearly everything
in a "family" div, leaving the div with essentially no content. Thus the
div height collapses to a minimum value determined by padding and
margin. The same thing occurs for non-floated divs that do not have any
content.

Add   to each div that does not have any content besides other
floated divs, or non-floated divs (e.g., "children") with no content.

I actually managed to get a css solution from another mailing list. The
issue is the .clearfix:after selectors clear:both property. Apparently
(I don't understand why - but it works) adding an overflow: property
solves it. I am trying to get a fuller explanation from that list.

But I take your point. I originally put the clearfix solution in as a
matter of principal - but its proving more trouble that its worth, and
essentially making my css extremely difficult to understand. I think I
will try and add the padding in via &nbsp in the code as you suggest.


Reply With Quote
  #4  
Old   
Alan Chandler
 
Posts: n/a

Default Re: Strange cross linking of div heights. - 09-17-2005 , 05:16 AM



Alan Chandler wrote:
Quote:
Jim Moe wrote:



Add   to each div that does not have any content besides other
floated divs, or non-floated divs (e.g., "children") with no content.


I actually managed to get a css solution from another mailing list. The
issue is the .clearfix:after selectors clear:both property. Apparently
(I don't understand why - but it works) adding an overflow: property
solves it. I am trying to get a fuller explanation from that list.

But I take your point. I originally put the clearfix solution in as a
matter of principal - but its proving more trouble that its worth, and
essentially making my css extremely difficult to understand. I think I
will try and add the padding in via &nbsp in the code as you suggest.
Unfortunately it doesn't work.

The embedded floating divs sometimes wordwrap (depends on browser window
width) and get a height that is greater than one line. The   only
makes the surrounding div one line high, which in these cases is not enough.

I am still going to have to put a clear property in somehow.


Reply With Quote
  #5  
Old   
Jim Moe
 
Posts: n/a

Default Re: Strange cross linking of div heights. - 09-17-2005 , 03:39 PM



Alan Chandler wrote:
Quote:
Unfortunately it doesn't work.

The embedded floating divs sometimes wordwrap (depends on browser window
width) and get a height that is greater than one line. The   only
makes the surrounding div one line high, which in these cases is not
enough.

Because many, but not all, of the divs are floated, you are going to
have this problem; a div without actual content always collapses. Attempts
to work around it only aggravates the problem and creates a maintenance
nightmare.
You are displaying tabular data. Is there some reason why you are not
using tables?

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.