如今,在移动设备上使我的网站工作需要我了解什么?

4
这个问题基于2009年发布的一些旧网站和特定的Microsoft内容,具体请参考如何让我的网站在移动浏览器上工作?
我主要使用Django制作web应用程序,在Android / iPhone /其他移动设备上似乎效果不佳。
有一些应用程序(例如django-mobile:https://github.com/gregmuellegger/django-mobile)提供了根据设备类型制作不同网站的可能性。 问题是,如果我们想在Android、iPhone和PC上使用该应用程序,则几乎必须制作3个网站。
2006年W3C有一些推荐方案(http://www.w3.org/TR/2006/CR-mobile-bp-20060627/),但我认为这已经过时了,因为6年时间使得互联网和设备完全不同。
有任何相关贡献吗?
1个回答

4
据我所知(如果我错了请纠正),Django是一个Python框架,因此运行在服务器端。这不应该影响任何在手机上运行的东西。所有的智能手机都能够运行HTML/CSS和JavaScript/jQuery。
如果你说的是关于页面如何显示在这样一个小屏幕上,有几个选项:
  1. Have a responsive design that adapts to the device's screen size. Have a look at Bootstrap.
  2. Have a separate mobile site and something that will detect a mobile/tablet device and forward it to the mobile site running on a subdomain like mobile.mysite.com.
  3. Have a non-responsive site and use the viewport meta tag.
  4. Another option is to use css media queries, which allow you to set conditional css depending on the screen or browser dimensions like this :

    @media only screen 
    and (min-width : 325px) 
    and (max-width : 500px) {
    /*CONDITION CSS*/
    }
    

媒体查询的好处在于你可以非常详细地进行设置,理论上你可以为数百种设备设置媒体查询,并分别指定设备横向和纵向模式下的特定css。

这篇关于罗姆尼对奥巴马竞选的有趣文章讲述了两个政党如何不同地开发他们的移动网站。


1
+1. 我正准备将Twitter Bootstrap作为越来越流行的使用流体布局和@media查询的示例发布。 - Chaser324

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接