web pages display setter/ pixel fixer

Various computer screens have different pixel measurement. The same specified height and width given for an element during programming a webpage/website, gives different display output on screens of different size and pixel measures. How can we retrieve the pixel dimension of a screen webpage is running on and dynamically set the attributes accordingly.
Eg. when we run Codechef.com on and screen of any dimensions, the display is same.

How can i do that with the webpage i’m making ?