开发者

How to find the screen real estate of a mobile device?

I'm planing to develop mobile version for my website, I need to consider all the devices like with different screen dimensions. I tried to find out a way to get the real estate width of mobile devise to shoe my mobile site accor开发者_开发知识库dingly, can anybody please suggest a solution for this problem. I'll be very happy if I got some solution to this problem using jQuery or PHP because I'm using these to develop my mobile website.


Instead of using JavaScript, use CSS3 media queries to target different screen sizes, for example:

<link type="text/css" rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" />

Update: If really necessary, use screen.width and screen.height to access the width and height of the screen.

W3C CSS3 Media Queries

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜