0

私はこれについてかなりの量の調査を行いましたが、これを理解することに成功していません. レスポンシブ グリッドに lessframework.css を使用して、レスポンシブ サイトで作業しています。768px から 1024px の間のどのタブレット サイズにも適切にスナップされません。その画面サイズで要素を調べると、.container がそれらの寸法の間でサイズ変更されていないように見えます。ただし、これが特定の px サイズに指定されている css のどこにも表示されないため、オーバーライドします。以前の開発者からこのプロジェクトを取り上げましたが、レスポンシブ コードは初めてです。与えることができるどんな助けも大きな助けになるでしょう。ありがとうございました!

ウェブサイトは www.mereo.co

以下は、lessframework.css グリッドのコードのサンプルです。

/*  Default 8-column layout
    60 px columns, 24 px gutters, 60 px margins, 768 px total
    ---------------------------------------------------------
    1     2      3      4      5      6      7      8     
    60px  144px  228px  312px  396px  480px  564px  648px   */

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Styles */
}


#if-logged-in {
    position: relative;
    width: 100%;
    height: 24px;
    line-height: 24px;
    background: #000;
    color: #aaa;
    font-size: 10px;
    z-index: 1000;
}
    #if-logged-in .container {
        padding-top: 0;
        padding-bottom: 0;
    }
    #if-logged-in p {
        margin: 0;
    }
    #if-logged-in a:link,
    #if-logged-in a:visited {
        color: #fff;
        text-decoration: none;
    }
    #if-logged-in a:hover {
        text-decoration: underline;
    }
    #if-logged-in a:active {
        text-decoration: underline;
        margin-bottom: -1px;
    }


.container {
    /*padding: 0 60px;*/
    width: 768px;
    margin: 0 auto;
    overflow: hidden;
}
    #header-image {
        padding: 0;
        overflow: hidden;
    }
        /* HEADER IMAGE
            full size - 1068x300
            8 column layout resized to 890x250 displayed at 648x250
            5 column layout resized to 534x150 displayed at 396x150
            3 column layout resized to 365x100 displayed at 228x100
         */
        #header-image img {
            width: 890px;
            height: 250px;
            margin-left: -121px;
            padding: 0;
        }
    #content {
        width: 356px; /* 5 columns */
        margin: 0;
        padding: 20px;
        overflow: hidden;
    }
    #sidebar {
        width: 184px; /* 3 columns */
        margin: 0;
        padding: 20px;
        overflow: hidden;
    }

::selection {
    background: #c6d8cd;
}
::-moz-selection {
    background: #c6d8cd;
}
img::selection {
    background: transparent;
}
img::-moz-selection {
    background: transparent;
}
4

1 に答える 1

0

そのiPadのサイズと解像度に固有の.container { }スタイルは、そこにあるメディアクエリ内にある必要があります。したがって、コンテナが iPad で幅 400px である必要がある場合、コードは次のようになります。

/* iPad 1 & 2 (landscape) */
@media (device-width: 1024px) and (device-height: 768px) and (orientation: landscape) {
    .container {
        width: 400px;
        /* all other .container styles specific to the iPad 2 in landscape should go here */
    }
    #if-logged-in {
        /* other styles go in their respective selector in the media query */
    }
}

Retina ディスプレイのない iPad があることを忘れないでください。つまり、css からロードする背景画像または svg 画像がある場合は、Retina iPad で見栄えを良くするために 2 倍の解像度のアセットを指すように設定する必要があります。 Retina iPad メディア クエリ内。

于 2013-07-07T21:06:55.277 に答える