views:

66

answers:

4

Hi guys,

I would want to simulate the behavior of a table with div.

I have a struct of my layout divide into three columns:

div#wrapper {
  width:800px;
  float:left;
  height:100%;
  margin-top:7px;
  text-align:center;
}
div#left {
  width:167px;
  float:left;
  padding-bottom:50px;
  margin-right:3px;
}
div#main {
  width:454px;
  float:left;
}
div#right {
  width:167px;
  float:left;
  margin-left:3px;
}

wrapper is the container of three columns left,main,right

div "main" have a variable content so in some case is more long and in other case is very short. When the content vary,div wrapper is adapted and it's ok but left and right columns don't adapt to wrapper.

P.S Without doctype there is no problem, infact I set the height of left, main and right to 100% but when I insert transional.dtd , the height of div is not considered.

How can resolve this problem?

Sorry for my english!!

+1  A: 

You could try to insert:

min-height: 100%;

as well, to cover yourself :)

Neurofluxation
min-height:100% in every div?
Ivan90
min-height doesnt work on IE
marcgg
:( in my case min-height doesnt work in everywhere.
Ivan90
Why was this voted down? @Ivan90 never said it was IE specific or anything, and you can add "min-height" as well as "height" AND I didn't say "EVERY DIV"...
Neurofluxation
Sorry you're right. you never didn't say Every div.
Ivan90
A: 

I try to use

min-height:100%;

but I can solve the problem.

I read in different forum that is not possibile with xhtml fixed height:100% with a div, and that the only one method to solve this problem is to use JQuery?

Ivan90
A: 

you should use jQuery

<script type="text/javascript">
$(this).load(function() {
   alert(document.documentElement.clientHeight + '+' + $(window).height());
   if ($(window).height() - 250 > 300)
      $('#content').css('min-height', '224px');
   else
      $('#content').css('min-height', $(window).height() - 250);
    }
);
$(this).resize(function() {
    if ($(window).height() - 250 > 300)
       $('#content').css('min-height', '224px');
    else
       $('#content').css('min-height', $(window).height() - 250);
    }
);
</script>

<div id="content" style="min-height:350px;">

</div>

just change numeric digits of hights.

AjmeraInfo
#content in my case is wrapper? right?
Ivan90
I hate to pick fault, but it's not good practise to use JQuery for standard CSS "stuffs" if it can be done in CSS.
Neurofluxation
You are the best :) Finally I resolved my problem.I must offert you a virtual coffee :)Thanks thanks
Ivan90
+1  A: 

I agree with @Neurofluxation so let's see what I can find on Google:

100% Height Layout Using CSS and CSS Faux Columns

rohancragg
Good stuff.Thanks. I'll try to use only css. I am thinking infact that if javascript in browser is disabled doesnt' work!
Ivan90