【发布时间】:2014-01-12 16:57:35
【问题描述】:
我正在尝试解决这个问题:
我正在使用 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%;
}
大图完美运行 - 它是响应式的。但是有没有一些简单的方法可以让较小的图片也有响应?它们的大小现在根据屏幕分辨率而变化...非常感谢您提供的一些提示!
【问题讨论】:
-
您是否尝试过对那些较小的图像使用相对定位而不是绝对定位?绝对定位和响应式设计通常不能很好地结合在一起。
-
你能用你的代码发布一个 FIDDLE 吗?
-
您是否为此尝试过引导网格系统?
-
位置绝对+响应=头痛!
标签: html css twitter-bootstrap responsive-design