July 17, 2012

css get height of screen resolution

Question by FishBowlGuy

im having a hard time getting the height of lower screen resolution because my screen resolution is 1920×1080 does anyone know how to get the height and width screen resolution?
because my friend has 1024×768 resolution when he checked my work into his computer, its all messed up, this is my only problem when it comes to CSS the height and width.

Answer by Starx

It is not possible to get the height of the screen from CSS. However, using since CSS3 you can use media queries to control the display of the template as per the resolution.

If you want to code on the basis of height using media queries, you can define style-sheet and call it like this.

<link rel="stylesheet" media="screen and (device-height: 600px)" />

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!