我的手机没有显示我的网站的移动版本 [英] My phone is not displaying the mobile oriented version of my site

查看:84
本文介绍了我的手机没有显示我的网站的移动版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上使用以下HTML:

I am using the following HTML on my site:

<head>
    <link rel="stylesheet" type="text/css" href="css/style.css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="css/mobile.css" media="handheld"/>
</head>

这样做的目的是在适当的浏览器检测。我的问题是,我的HTC Hero Android浏览器不显示该网站的移动版本,而是显示只有桌面版本。我的浏览器设置为尽可能显示网站的移动版本。我在这里做错了什么?

The purpose of this is to switch between the desktop and mobile version of the site when the appropriate browser is detected. My problem is that my HTC Hero Android browser is not displaying the mobile version of the site, and is instead displaying only the desktop version. My browser is set to display the mobile version of a site where possible. What am I doing wrong here?

PS。移动网站只是我的课程的技术演示,所以它只需要在我的浏览器中可以看到,有一个移动版本的网站(这是我正在评估的CSS)。

PS. The mobile site is only a tech demo for my coursework, and so it only needs to be viewable in my browser to show that there is a mobile version of the site (it's my CSS that's being evaluated).

推荐答案


掌上电脑用于为移动设备附加CSS文件
,但未使用
通过Android和iPhone。

handheld is used to attach CSS file for mobile devices, but it isn't used by Android and iPhone.

源: http://www.rkblog.rk.edu.pl/w/p/optimizing-websites-iphone-and-android/

因此,您可以使用类似以下的内容:

So you can use something like the following:

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

这篇关于我的手机没有显示我的网站的移动版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆