donglan8870 2011-02-04 05:40
浏览 33
已采纳

如何找到移动设备的屏幕空间?

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 accordingly, 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.

  • 写回答

1条回答 默认 最新

  • duancheng1955 2011-02-04 05:47
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘