简体   繁体   English

最大高度和最大宽度媒体查询不起作用?

[英]Max-height and max-width media query not working?

My site is responsive for width using bootstrap, but I'm also trying to get one section to specifically be responsive for Landscape media queries... but when I do the live BrowserSync, it's not taking into consideration any of my media query requests... Any tips are appreciated. 我的网站使用引导程序来响应宽度,但是我也试图让一个部分专门响应风景媒体查询...但是当我进行实时BrowserSync时,它没有考虑我的任何媒体查询请求。 ..任何提示,不胜感激。

In my style.scss, does the media query section need to be in a particular layout? 在我的style.scss中,媒体查询部分是否需要采用特定的布局? Right now I just put it in the middle? 现在我只是把它放在中间?

@media all and (max-height: 267px) and (max-width: 667px) {
body {
    overflow-x: hidden;
}

#header {
    .name-tag-image {
        width: 400px;
        height: auto;
        padding-right: 20px;
        margin-left: 40px;
        padding-top: 75px;
    }

    .my-name-is-text {
        font-size: 1rem;
        font-weight: 400;
        padding-bottom: 0px;
        margin-bottom: -20px;
    }

    #resume-buttons {
        .resume-header-button {
            margin-top: 15px;
        }
    }

    .btn-circle.btn-xl {
        width: 30px;
        height: 30px;
        padding: 3px 6px;
        font-size: 12px;
        line-height: 1.33;
        border-radius: 35px;
        border: 3px solid #fff;
    } 
}

} }

In addition to the important comment above by ittus 除了上述ittus的重要评论之外

In my style.scss, does the media query section need to be in a particular layout? 在我的style.scss中,媒体查询部分是否需要采用特定的布局?

Yes, order matters. 是的,订单很重要。 The usual cascading rules apply, so if you have 通常会采用级联规则,因此如果您有

@media all and (max-height: 267px) and (max-width: 667px) {
body {
    overflow-x: hidden;
}  
...  
}  

and later in your stylesheet you had 后来在样式表中

body{
overflow-x:visible;  
}  

then styling of overflow-x:visible; 然后样式overflow-x:visible; would be applied at all viewports. 将应用于所有视口。

Also, a max height of 267px seems low, I think an iPhone5 in landscape would be 320, and most newer smartphones would be higher. 另外,最大高度为267px似乎很低,我认为横向的iPhone5为320,大多数新的智能手机会更高。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM