Html 对手持设备、iPhone和浏览器的CSS支持

Html 对手持设备、iPhone和浏览器的CSS支持,html,css,mobile-website,Html,Css,Mobile Website,我的index.xhtml中有以下内容 style type="text/css" media="screen and (min-width: 500px)" @import "style/index.css"; /style style type="text/css" media="screen and (max-width: 500px)" @import "style/portable.css"; /style style type="text/css" m

我的index.xhtml中有以下内容

style type="text/css" media="screen and (min-width: 500px)" @import "style/index.css"; /style style type="text/css" media="screen and (max-width: 500px)" @import "style/portable.css"; /style style type="text/css" media="handheld" @import "style/handheld.css"; /style
它在Opera、Opera Mini、iPhone和一系列手持设备N70、摩托罗拉都能很好地工作,但它拒绝与Konqueror和Firefox合作。我该如何解决这个问题?我想将CSS保存在单独的文件中,我不喜欢在@media screen{}中包含/嵌入大量CSS。我也不喜欢使用link,因为风格是我们在其他页面中使用过的

我看不出在使用上有什么区别@导入还发送一个请求


期待更多的失败。如果你的目标不仅仅是现代手机,那就忘了css媒体查询吧。您可能希望实施一个服务器端解决方案来了解设备的功能和屏幕

这种方法允许您为不理解媒体查询的旧移动设备提供基本样式,然后为智能手机、平板电脑和桌面浏览器添加更高级的CSS

<link rel="stylesheet" href="css/styles-base.css" />
<!-- for all devices; includes any base ("reset") styles required  -->

<link rel="stylesheet" media="only handheld and (min-width: 300px), only screen and (min-width: 300px)" href="css/styles-modern-300.css" />
<!-- for all modern devices, including "smartphones" -->

<link rel="stylesheet" media="only screen and (min-width: 740px)" href="css/styles-modern-740px.css" />
<!-- for all modern devices with "tablet-sized" and larger viewports (including iPad) -->

<link rel="stylesheet" media="only screen and (min-width: 1000px)" href="css/styles-modern-1000px.css" />
<!-- for all modern devices with "desktop-sized" and larger viewports -->

<link rel="stylesheet" media="only screen and (min-width: 1200px)" href="css/styles-modern-1200px.css" />
<!-- for all modern devices with "larger desktop-sized" viewports -->

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=3.0;">
我想说,如果你想为手机提供样式支持,那么对现代设备额外的几次HTTP请求是你最不担心的


你也可以使用它。

我对link的另一个问题是,如果我这样做的话,它在FF中不起作用:link rel=stylesheet media=only screen href=style/index.css/或link rel=stylesheet media=only screen href=style/index.css/[[media=screen works尽管如此]]我使用的是FF IceWeasel-Linux Mozilla/5.0 X11;ULinux i686;恩美;rv:1.9.0.19 Gecko/20101Mozilla/5.0 X11;ULinux i686;恩美;rv:1.9.0.19 Gecko/2010120923 Iceweasel/3.0.6-320923 Iceweasel/3.0.6-Debian-3.0.6-3谢谢,我必须使用perl或.htaccess做点什么