jQuery Screen Resolution Height Adjustment

Brad Birdsall picture Brad Birdsall · Aug 13, 2009 · Viewed 146.4k times · Source

In order to better balance out a page I am working on I would like to find a way to increase the top margin of a DIV depending on the screen resolution. What is my best way to set these dimensions with jQuery or Javascript?

Answer

RaYell picture RaYell · Aug 13, 2009

To get screen resolution in JS use screen object

screen.height;
screen.width;

Based on that values you can calculate your margin to whatever suits you.