0

これは私のメタタグです...

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

ブレークポイントを最大 320、次に最大 480 として使用しています。デバイス幅 320 からページをテストしているときは問題なく動作していますが、デバイス幅 480 でページをテストしているときは、まだ幅 320 のスタイルシートが選択されています。間違ったスタイルシートを選択している理由を教えてください..

<link rel="stylesheet" media="only screen and (max-width:320px) and (orientation:portrait)" href="style/xxs_p.css">
<link rel="stylesheet" media="only screen and (max-width:320px) and (orientation:landscape)" href="style/xxs_l.css">
<link rel="stylesheet" media="only screen and (min-width:321px) and (max-width:480px) and (orientation:portrait)" href="style/xs_p.css">
<link rel="stylesheet" media="only screen and (min-width:321px) and (max-width:480px) and (orientation:landscape)" href="style/xs_l.css">

それは私のコードの問題ですか、それともエミュレーターの動作がおかしいだけですか? 助けてください!!

4

2 に答える 2

0

私はこれを使用し、完全に機能します:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=1">
<link href="/cssL.css" rel="stylesheet" type="text/css" media="(min-width:1000px)" />
<link href="/cssM.css" rel="stylesheet" type="text/css" media="(min-width:551px) and (max-width:999px)"  />
<link href="/cssS.css" rel="stylesheet" type="text/css" media="(max-width:550px)" />

ビューポート メタでコンマの代わりにセミコロンを使用した場合、問題が発生した可能性があります。

于 2014-11-16T14:23:06.580 に答える