我正在尝试让“pad1”类在我的 Ipad(宽度为 768px)上工作,
所以我尝试了这段代码:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<style>
@media (min-width: 767px) and (max-width:991px){
.pad1 {
margin-top: 150px;
}
}
</style>
<div class="container">
<div class="row pad1">
<div class="col-sm-4" style="background-color: orange;">
AAAAA
</div>
</div>
</div>
</body>
</html>
但是填充不起作用,而如果我删除 和 (max-width:991px)
部分它会起作用..
我还尝试了其他帖子中的其他解决方案,例如:
@media only screen and (min-device-width: 767px) and (max-device-width: 991px) and (orientation:portrait) {
.pad1 {
margin-top: 150px;
}
但它仍然不起作用,我被困在这里,我绝对需要限制这个类的最大宽度
,你有什么解决办法吗?
谢谢
最佳答案
更改为:
@media all and (min-device-width:767px) and (max-device-width:991px){
.pad1 {
margin-top: 150px;
}
}
希望对你有帮助
关于html - Bootstrap : @media min-width AND max-width does not work on Ipad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44364536/