我希望将一些样式应用于智能手机,包括纵向和横向。
是否有针对这两种情况的良好媒体查询?实际上我必须用两个媒体查询重复 css:
.selector {
// smartphone portrait
@media (min-width: 320px}) and (max-width: 512px}) {
// stuff
}
// smartphone landscape
@media only screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape) {
// same stuff
}
}
最佳答案
我相信,如果您创建一个媒体查询,其中最小宽度是纵向手机屏幕宽度,最大宽度是横向手机屏幕宽度,那么无论方向如何,它都应该覆盖所有内容。
关于html - 同时针对智能手机纵向和横向的媒体查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47122839/