繁体   English   中英

“响应式图像优于响应式图像”-Twitter Bootstrap

[英]“Responsive image over responsive image” - Twitter Bootstrap

我正在尝试解决此问题:

我正在使用Twitter Bootstrap进行响应式设计。 有一张大图片作为主要内容的响应式背景图片(定位为“相对”),还有几张图片正在作为导航器使用-它们的位置是相当随机的(没有网格或类似的东西) :

HTML

<div class="container">
    <div class="row-fluid">     
        <div class="span12">
            <div id="LARGE_PICTURE">
                <img src="img/LARGE_PICTURE.png">
                <a href="#">
                    <img id="SMALL_PICTURE_1" src="SMALL_PICTURE_1.png">
                </a>
                <a href="#">
                    <img id="SMALL_PICTURE_2"src="SMALL_PICTURE_2.png">
                </a>
                <a href="#">
                    <img id="SMALL_PICTURE_3" src="SMALL_PICTURE_3.png">
                </a>
                <a href="#">
                    <img id="SMALL_PICTURE_4" src="SMALL_PICTURE_4.png">
                </a>
            </div>
        </div>           
    </div>
</div>

CSS

@import url('css/bootstrap.css');
@import url('css/bootstrap-responsive.css');
.container {
    background-image: url("img/bg.png");
}
#LARGE_PICTURE {
    position: relative;
}
#SMALL_PICTURE_1 {
    position:absolute;
    left:21%;
    top:24%;
}
#SMALL_PICTURE_2 {
    position:absolute;
    left:30%;
    top:13%;
}
#SMALL_PICTURE_3 {
    position:absolute;
    left:48%;
    top:26%;
}
#SMALL_PICTURE_4 {
    position:absolute;
    left:63%;
    top:16%;
}

大图可以完美显示-反应灵敏。 但是,是否有一些简单的方法也可以使较小的图片具有响应性? 它们的大小目前正在根据屏幕分辨率而变化...非常感谢您提供一些提示!

绝对位置+敏感=头痛。

您需要为每个媒体查询重新设置所有#SMALL_PICTURE_X {}的样式。

另外,您的html设计将失败,因为您正在定位包含在锚中的图像,但无法使用实际的锚标签。

要了解引导网格系统,可以转到v3文档v2文档

我认为您的情况是版本2,因此您将必须执行以下操作:

/* Large desktop */
@media (min-width: 1200px) {
    #SMALL_PICTURE_1 {
        position:absolute;
        left:21%;
        top:24%;
        width:SET_A_WIDTH;
        height:SET_A_HEIGHT;
    }
    #SMALL_PICTURE_2 {
        position:absolute;
        left:30%;
        top:13%;
        width:SET_A_WIDTH;
        height:SET_A_HEIGHT;
    }
    #SMALL_PICTURE_3 {
        position:absolute;
        left:48%;
        top:26%;
        width:SET_A_WIDTH;
        height:SET_A_HEIGHT;
    }
    #SMALL_PICTURE_4 {
        position:absolute;
        left:63%;
        top:16%;
        width:SET_A_WIDTH;
        height:SET_A_HEIGHT;
    }
}

/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) {
    #REPEAT_WHAT'S_BEEN_DONE_PREVIOUSLY {
    /* BY_POSITIONNING and SETTING_HEIGHT_AND_WIDTH */
    }

/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }

/* Landscape phones and down */
@media (max-width: 480px) { ... }

暂无
暂无

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

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