JQuery
$(window).ready(function(){
var w = $(window).width();//to detect the width of the browser
var h = $(window).height();//to detect the height of the browser
$(window).resize(function(){
var w = $(window).width();//new width of the browser
var h = $(window).height();//new height of the browser
$("#left").css('height'+ h 'px.');//this is where I'm not sure how to assign height value according to the browser size.
});
});
My css
#main
{
width: 100%;
height: 100%;
position: relative;
background: #000000;
}
#left
{
width: 20%;
height: 650px;
position: relative;
float: left;
background: #666666;
}
#right
{
width:80%;
height: 650px;
position: relative;
float:right;
background: #ff9900;
}
My Html
<div id="main">
<div id="left">
</div>
<div id="right">
</div>
</div>
Now the problem is the height of left and right DIV. if I set the height:100%; it follows the content height ,which I don't want . I want the height stretched down to fit the browser height. So if I use, height:650px; it works but how if the page resized to smaller or bigger size? How to detect the size of the browser the page being viewed and proportionally change the height so that there won't be scrollbar?