开发者

Targetting Android Mobile Devices (Galaxy S) with CSS

I'm trying to target Android devices with a CSS file, but I've been unsuccessful until now. I'm using the following CSS code:

开发者_开发技巧@media only screen and (max-device-width: 800px) {
    body { max-width: 100%; background-color:#000; }
}

I'm also invoking the css code with the following line in the PHP file:

<link rel="stylesheet" type="text/css" href="small.css" />

Any thoughts on what I might be doing wrong?

Thanks


Within PHP, you can check user agent, and based on that apply an appropriate style sheet.

And don't forget the viewport setting within a meta tag:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜