SORU
25 Kasım 2011, Cuma


CSS iPad ve iPad hedef medya sorgu sadece?

Birden fazla tablet cihazlar ile çalışıyorum Merhaba, iPad, Galaxy Tab, Acer Iconia, 3D Pad ve LG.

  • - 1024 x 768 iPad
  • LG Pad - 1280 x 768
  • Galaxy Tab 1280 x 800

İPad hedef istiyorum. Beri, LG ve iPad cihaz genişliği 768 px - sorun her aygıt ayıran yaşıyorum aynı.

Ayırmak için aşağıdaki denedim, ama çalışmak için görünmüyor:

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation : portrait) /* applied to lg also */
@media only screen and (min-resolution: 132dpi) and (max-device-width: 1024px) and (orientation : portrait) /* applies to lg also */
@media only screen and (device-aspect-ratio: 1024/768) and (orientation : portrait) /* does not work on iPad or LG */

Bilmiyorum -y-device-pixel-ratio ve-y* seçenekleri ve iPad için hedef değerler. Stilleri, herhangi bir fikir için JavaScript kullanmak istemiyorum?

CEVAP
29 ŞUBAT 2012, ÇARŞAMBA


Sonunda bir çözüm buldum : Detect different device platforms using CSS

<link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait)" href="ipad-portrait.css" />
<link rel="stylesheet" media="all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape)" href="ipad-landscape.css" />

HTTP arayın azaltmak için, bu da ortak CSS dosyası mevcut içinde kullanılabilir:

@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:portrait) {
  .ipad-portrait { color: red; } /* your css rules for ipad portrait */
}
@media all and (device-width: 768px) and (device-height: 1024px) and (orientation:landscape) {
  .ipad-landscape { color: blue; } /* your css rules for ipad landscape */
}

Bu yardımcı olur umarım.

Diğer kaynaklar:

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • STITCHLESS TV how to sew your own style tutorials

    STITCHLESS T

    9 HAZİRAN 2011
  • Toddler Fun Learning

    Toddler Fun

    8 ŞUBAT 2013
  • Video-Tutorials.Net

    Video-Tutori

    15 Mart 2011