user472402
user472402

Reputation: 313

Fit content in various screens

I have a html page which is table based. I have a ul as menu few charts and few tables. I am trying to design it such that it just fits in any screen without any scrollbar. My browser doesn't honer the height=100% which i tried for the main table of the page. Any thoughts? Thanks in advance :)

Upvotes: 1

Views: 71

Answers (2)

bozdoz
bozdoz

Reputation: 12870

Here is javascript/jquery code that I have used to force the height of certain elements.

function resize(){
winH = 460; 
if (document.body && document.body.offsetWidth) {
 winH = document.body.offsetHeight;
}
if (document.compatMode=='CSS1Compat' &&
    document.documentElement &&
    document.documentElement.offsetWidth ) {
 winH = document.documentElement.offsetHeight;
}
if (window.innerWidth && window.innerHeight) {
 winH = window.innerHeight;
}
$('#container').height(winH);
}
$(function(){
  resize();
  });
//the following code readjusts the element's height every time the browser window is altered. 
window.onresize = function() {
  resize();
  }

Upvotes: 0

Mhmd
Mhmd

Reputation: 5167

you will not fit height as you want except using javascript, or use frameset

Upvotes: 1

Related Questions