I need to set the height of my webpage constant in any screen size.Is it possible.Please help.
My content is in a wrap div
<div id="wrap"></div>
Thanks
I need to set the height of my webpage constant in any screen size.Is it possible.Please help.
My content is in a wrap div
<div id="wrap"></div>
Thanks
Well, what is that constant? More details would be helpful. But, have you tried setting the height?--for example.
html, body {
height: 200px;
}
#wrap {
height: 200px;
}
You can also try with positioning. This does not require you set the height of html
and body
as the first example does.
#wrap {
bottom: 0; /* change this */
left: 0;
position: absolute;
right: 0;
top: 0; /* and this to fit your requirements */
}
The problem that most developers encounter when trying to do this is that when setting the height of a div to 100% it actually flattens to 0px. This is because 100% of nothing is nothing.
Since the body and html tags are both parent of your div they need to be adjusted first.
html,body{
height: 100%;
width: 100%;
overflow: hidden;
}
#wrap{
height: 100%;
width: 100%;
overflow: auto;
}
its not possible to maintain constant height in different screen sizes