Click here to Skip to main content
15,894,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to set the height of div equal to browser window height.
so please tell me how to get window size and set the height of div equal to it .
Posted
Comments
F-ES Sitecore 14-Dec-15 7:11am    
Have you tried googling for an answer? Google "set div height to browser" and you'll probably find examples.

you can do this way
$(function() {

$("#id")
.width($(window).width()).height($(window).height());
});
 
Share this answer
 
HTML
<div style="height:100%;"><div>.</div></div>


Although, you may wish to modify this to even 105%.
So set, it will correspond to the user's browser when created.

I've not found it that satisfactory, but you may wish to also set the size of controls (and other elements) by %, as well, to maintain proportionality.

Now - on the other hand - if you wish to really modify the window continuously: you can use the DOM (javaScript) and modify this property when the window height is modified. This is probably not worth your trouble.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900