Forums / Setup & design / div height 100% problem

div height 100% problem

Author Message

Valentina Ferrari

Friday 02 July 2004 2:49:42 am

Hi!
I'm building a new site using a totally table-less design (only with DIV), using CSS.
My site has header, footer, right column, left column and content column.
I would like to view all my columns at the same height; so if the content column is longer than left and right columns I want that all the columns has the same height.

Buy DOESN'T WORKS!

In my stylesheet the body and the container div has height 100% (the container div contains all the elements of my site: footer, header, right, left and content columns).
Also right, left and content columns has height 100%.

I'm optimizing my site for IE 5.5, IE 6.0, NS 6.2, NS 7.1, Opera and Mozilla (last version).

I don't know want I have to do!!
Anyone has the same problem? Anyone has the solution?

Thanks a lot!
Valentina

Paul Forsyth

Friday 02 July 2004 3:14:35 am

Try adding this to your css:

/* Fix for body height problem, from: http://www.sitepoint.com/forums/showthread.php?t=166525 */
.clear
{
  clear:both;
/*** these next attributes are designed to keep the div
height to 0 pixels high, critical for Safari and Netscape 7 ***/
  height:1px;
  overflow:hidden;
  margin-bottom:-1px;
}

/*** stops IE browsers from displaying
the clear div/br in the page, as these are for Moz/Opera and
Safari only. If IE 5.x Win DID display these, the page is too high ***/
* html .clear
{
	display:none	
} 

and then in your html at the end before the final </div> (though it may just be necessary in the center div).

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

Its a hack but seems to work.

paul

--
http://www.visionwt.com

Valentina Ferrari

Friday 02 July 2004 5:10:08 am

Hi Paul,
thank you for your suggest but I have the same problem.
Maybe I didn't explain so well my site situation.

So if you want help me you can see the image that explain the problem at this URL:
www.bossoniecipriani.it/mysite.gif

Thank you very much!
Valentina

Paul Forsyth

Friday 02 July 2004 6:10:16 am

Im away for the weekend now so i cant help any further, sorry.

But, play around with that code and follow the link given. It does do what you want.

paul

Alex Jones

Friday 02 July 2004 7:21:14 am

Valentina, the easiest solution would be to assign a background image (which shows all three columns) to your container div. This way, no matter what, all three are shown. An example of this method is detailed here: http://www.alistapart.com/articles/fauxcolumns/ Note, this will only work if you are using a fixed-width design.

Alex
bald_technologist on the IRC channel: #eZpublish
http://www.agrussell.com :: http://www.cuttingedge.com

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Patrick Woods

Friday 02 July 2004 1:57:22 pm

I recently had to deal with this for work. Some javascript takes care of the problem. Feel free to re-use this function if you find it useful. I found it works pretty well. The only requirement is that you place your 3 columns inside another DIV so there is some useless markup but it pays off.

function equalHeights(element) {
		var content = document.getElementById(element);
		var desiredHeight = content.offsetHeight;
		var contentDivs = content.getElementsByTagName('div');
		for(i=0; i < contentDivs.length; i++) {
		if (contentDivs[i].parentNode.id == element) {
			contentDivs[i].style.height = desiredHeight + 'px';
			}
		}
}

Then just call the function on page load using your favorite method (I like using addEvent), passing the DIV that contains all 3 columns

 
equalHeights('column_container_div');

This won't work on anything that doens't support the W3C DOM but it will still degrade very well. Hope it helps you out.

--Patrick
http://www.hakjoon.com/

--
www.hakjoon.com

Lazaro Ferreira

Friday 27 August 2004 10:53:38 am

Hi Patrick,

I have tested this JavaScript Code, it works fine for IE, but it doesn't work for
NN 7.1, nor for Mozilla

Have you tested this for Mozilla or Netscape Navigator ?

Thanks
Lazaro

Lazaro
http://www.mzbusiness.com

Patrick Woods

Friday 27 August 2004 4:29:42 pm

I created the code in Mozilla, so in my experience it works. Are you using floats by any chance? In Mozilla a container won't expand to the height of floated children unless the container itself is floated. Could that be the reason?

I have a new version that takes margins and padding into account but I need to tweak it a little bit more. I'll release it to the forum once I have it all tweaked.

I'd be happy to take a look at stuff and see if I can figure out why it's not working for you.

--Patrick

--
www.hakjoon.com

eZ debug

Timing: Jan 18 2025 19:18:16
Script start
Timing: Jan 18 2025 19:18:16
Module start 'content'
Timing: Jan 18 2025 19:18:17
Module end 'content'
Timing: Jan 18 2025 19:18:17
Script end

Main resources:

Total runtime1.0922 sec
Peak memory usage4,096.0000 KB
Database Queries215

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0115 589.1328180.8438
Module start 'content' 0.01150.9409 769.9766720.2344
Module end 'content' 0.95240.1393 1,490.2109340.4453
Script end 1.0917  1,830.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00540.4900210.0003
Check MTime0.00170.1595210.0001
Mysql Total
Database connection0.00230.207110.0023
Mysqli_queries0.991290.75202150.0046
Looping result0.00230.21222130.0000
Template Total1.054896.620.5274
Template load0.00220.199020.0011
Template processing1.052796.376220.5263
Template load and register function0.00020.021310.0002
states
state_id_array0.00130.123210.0013
state_identifier_array0.00080.077420.0004
Override
Cache load0.00200.1807640.0000
Sytem overhead
Fetch class attribute can translate value0.00120.111960.0002
Fetch class attribute name0.00120.1105100.0001
XML
Image XML parsing0.00210.188560.0003
class_abstraction
Instantiating content class attribute0.00000.0019110.0000
General
dbfile0.00460.4215330.0001
String conversion0.00000.001330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
22content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 51
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs