关于移动端UI适配的整理

对于移动端web设计时,常常会由于移动设备的不同而导致各式各样的麻烦。那么用一个统一的模板来进行移动web开发是必须的。media query想必大家都不陌生,他可以通过设备的宽度来改变css,那么接下来我将整理好的这部分代码贴出来供大家来拷贝使用。



/**
* iPhone 4/4s landscape & portrait
*/
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3) {

}

/**
* iPhone 4/4s portrait
*/
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3) and (orientation:portrait) {

}

/**
* iPhone 4/4s landscape
*/
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2/3) and (orientation:landscape) {


}

/**
* iPhone 5/5s landscape & portrait
*/
@media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-min-device-pixel-ratio: 2) {


}

/**
* iPhone 5/5s portrait
*/
@media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {

}

/**
* iPhone 5/5s landscape
*/
@media only screen and (min-device-width: 320px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) {


}

/**
* iPhone 5/5s landscape & portrait
*/
@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-min-device-pixel-ratio: 3) {

}

/**
* iPhone 5/5s portrait
*/
@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-min-device-pixel-ratio: 3) and (orientation: portrait) {

}

/**
* iPhone 5/5s landscape
*/
@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-min-device-pixel-ratio: 3) and (orientation: landscape) {

}

@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) {
//iPhone 6 Portrait
}


@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) {
//iPhone 6 landscape
}


@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) {
//iPhone 6+ Portrait
}


@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : landscape) {
//iPhone 6+ landscape
}

@media only screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px){
//iPhone 6 and iPhone 6+ portrait and landscape
}

@media only screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : portrait){
//iPhone 6 and iPhone 6+ portrait
}

@media only screen and (max-device-width: 640px), only screen and (max-device-width: 667px), only screen and (max-width: 480px) and (orientation : landscape){
//iPhone 6 and iPhone 6+ landscape
}
/**
* Galaxy S3 landscape & portrait
*/
@media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 2) {

}

/**
* Galaxy S3 portrait
*/
@media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait) {

}

/**
* Galaxy S3 landscape
*/
@media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape) {

}

/**
* Galaxy S4 landscape & portrait
*/
@media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) {

}

/**
* Galaxy S4 portrait
*/
@media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) {

}

/**
* Galaxy S4 landscape
*/
@media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) {

}

/**
* Galaxy S5 landscape & portrait
*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) {

}

/**
* Galaxy S4 portrait
*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) {

}

/**
* Galaxy S4 landscape
*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) {

}

/**
* HTC One landscape & portrait
*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) {

}

/**
* HTC One portrait
*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) {

}

/**
* HTC One landscape
*/
@media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3 and (orientation: landscape) {

}


/**
* iPad Mini landscape & portrait
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1) {

}

/**
* iPad Mini portrait
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 1) {

}

/**
* iPad Mini landscape
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1) {

}

/**
* iPad 1/2 landscape & portrait
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1) {
}

/**
* iPad 1/2 portrait
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 1) {

}

/**
* iPad 1/2 landscape
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1) {

}

/**
* iPad 3/4 landscape & portrait
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {

}

/**
* iPad 3/4 portrait
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) {

}

/**
* iPad 3/4 landscape
*/
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) {

}

/**
* Galaxy Tab 10.1 landscape & portrait
*/
@media (min-device-width: 800px) and (max-device-width: 1280px) {

}

/**
* Galaxy Tab 10.1 portrait
*/
@media (max-device-width: 800px) and (orientation: portrait) {

}

/**
* Galaxy Tab 10.1 landscape
*/
@media (max-device-width: 1280px) and (orientation: landscape) {

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值