【问题标题】:Bootstrap 3 Media Queries working on Chrome but not on Mobile devicesBootstrap 3 媒体查询可在 Chrome 上运行,但不能在移动设备上运行
【发布时间】:2015-11-21 07:19:37
【问题描述】:

好吧,这个问题之前已经被问过很多次了,我每个人都问过,但对我没有用

在移动视图中,我想将幻灯片 col 位置从相对设置为静态,这将导致此

但我在移动设备上看到了这个(相邻的 col 重叠)

这意味着 Col 仍处于相对位置,媒体查询在移动平台上不起作用,但它在桌面 Chrome 浏览器中起作用。

我使用了元标记和不同的最小值和最大值组合(在确认屏幕分辨率后)

例如

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

 /* Smartphones (portrait and landscape) ----------- */
    @media only screen
    and (min-width : 320px)
    and (max-width : 480px) {

section.banner .slideshow-col{
        position: static;
    }

    /* Smartphones (landscape) ----------- */
    @media only screen
    and (min-width : 320px) {

section.banner .slideshow-col{
        position: static;
    }

 @media (min-width : 700px) {
   section.banner .slideshow-col{
        position: static;

    }

@media (min-width: 992px) {


        section.banner .slideshow-col{
        position: relative;
    }}

@media (min-width: 1200px) {


        section.banner .slideshow-col{
        position: relative;
    }}

我的网站在这里 http://

有什么提示吗?

【问题讨论】:

    标签: mobile twitter-bootstrap-3 media-queries overlapping


    【解决方案1】:

    尝试使用此解决方案

    @media screen and (max-width: 760px){
        .slideshow-col {
            position: relative;
            height: 300px; <--  height of the slideshow
            // You can use min & max height of slideshow for mobile devices
            height: auto;
            min-height: xxx;
            max-height: xxx;
        }
    }
    

    【讨论】:

    • 非常感谢它在 height:300px 下效果很好,但是自动高度和自动宽度不起作用,我必须硬编码 height ,但是我该如何处理右边的填充问题?我尝试了不同的宽度值,但似乎不起作用
    • 给幻灯片添加填充 .slideshow-col{padding: 20px;宽度:100%} 应该可以工作。
    • 所以我刚刚发现它可以在 iPhone 等某些平台上运行,但不能在 Windows Mobile 上运行......这是一些奇怪的行为,但无论如何再次感谢您的所有帮助
    猜你喜欢
    • 2018-03-04
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-04
    相关资源
    最近更新 更多