-1



私は 2 つの css フライを持つウェブサイトを持っています。最初の 1 つはデスクトップ画面でサイトを表示し、2 つ目は Ipad 画面でサイトを表示します。同じ HTML コードを持っていることを知って、
私の Q : Ipad を検出するコードはありますか?それに適したcssファイルを強制的に取得しますか??

thxx

編集されたセクション:
答えの親愛なる thxxx が css 効果が表示されなくなりました。何か間違ったコードを書いていると思います

<meta name="viewport" content="width=980" /><br/>
<link href="css/site.css" rel="stylesheet" type="text/css">


site.css 内に次のコードを記述します。

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 

{
*
    {
        margin::0;
        padding:0;
    }
    html , body
    {
        margin:0;
        padding:0;
        width:100%;
        font-family:"Trebuchet MS";
        font-size:12px;

    }
    .Wrapper{margin:0 auto;}

    .InnerWrapper{width:100%;
        margin:0; 
        padding-top:140px; 
        float:none; 
        display:block; 
        height:auto;}

    .Header{padding-bottom:0; 
        height:140px;
        background: none repeat scroll 0 0 #FFFFFF;
        z-index: 100000;
        position: fixed;
        color: #000000;
        float: left;
        width: 100%;
        box-shadow:0 -1px 7px 5px #888888;}
}

しかし、これは機能しません...助けてください!!

4

4 に答える 4

1

そのためにメディアクエリを使用できます。以下の CSS コードを iPad ファイルの先頭と、そのデバイスに関連するすべてのスタイル内に配置するだけです。

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Put your iPad styles here (this covers portrait and landscape modes) */
}

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Put your iPad styles here (this covers landscape mode)*/
}

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Put your iPad styles here (this covers portrait mode)*/
}

メディア クエリが行うことは、デバイスの幅をチェックして、iPhone、iPad、またはその他のモバイル デバイスかどうかを識別することです。詳細については、「メディアクエリ」をグーグルで検索してください。

于 2013-03-31T06:02:11.187 に答える
0

次のコード行を asp.net ソリューションの<header>エリアに追加します。

   <% if (Request.UserAgent.ToLower().Contains("ipad"))
    { %>
    <link rel="stylesheet" type="text/css" href="css/siteIpad.css" />

    <% } %>

うまくいっている、、、、

于 2013-05-07T07:36:32.117 に答える