【问题标题】:How to make a row of three images responsive如何使一排三个图像响应
【发布时间】:2014-04-06 13:20:20
【问题描述】:

使用 Twitter Bootstrap 3,我有一个容器、三个 div 占位符和三个作为链接填充的图像,每个图像并排浮动并占据整行:当我将屏幕最小化到让它响应,我只看到第一张图片(后两张消失)。我必须采取哪些步骤来确保每个图像都具有响应性并且在最小化 dmobile 显示屏幕上一个位于另一个之下。

请注意:每个图片。已经应用了 class="img-responsive"。

HTML:

 <!--Wide Display Container -->     
  <div class="wide-display">
   <div id="firstholder">
     <a href="home.html" title="Home" class="imglink"><img src="/images/slide2.JPG" alt="City Lights Image"  class="img-responsive" id="electricone"> 
       <div class="item1">
         <h1 class="slickfont1" >First Title</h1>
       </div> 
      </a>
   </div>
     <div id="secondholder">
       <a href="office.html" title="Office" class="imglink"><img src="/images/ant.JPG" alt="City Lights Image"  class="img-responsive" id="electrictwo">           
      <div class="item1">
        <h1 class="slickfont1" >Second Title</h1> </div></a>
      </div>
     <div id="thirdholder">
        <a href="reviews.html" title="Locations" class="imglink"><img src="/images/family.JPG" alt="City Lights Image"  class="img-responsive" id="thirdelectric"> 
        <div class="item1">
         <h1 class="slickfont1" > Third Title</h1>
        </div>
        </a>

   </div>
</div><!-- Wide Display Container -->

CSS:

.wide-display  {
    min-width:33%;
    position: relative;
    width: 100%;
    height:100%;
    margin-top:6px;
    overflow: hidden;
    height:366px;
}


/*! First img Holder */

#firstholder {
    width: 449px;
    height: 100%;
    float:left;
    display:inline-block;
    margin-left:1px;
    margin-right:0px;
}


.item1 {
    width: 24%;
    margin:  auto;
    position:relative;
}



#secondholder {
    width: 450px;
    height: 100%;
    float:left;
    display:inline-block;
    margin-right:0px;

}

#thirdholder {
    width: 449px;
    height: 100%;
    float:left;
    display:inline-block;
}

【问题讨论】:

    标签: image css responsive-design twitter-bootstrap-3


    【解决方案1】:

    您必须创建 Bootstrap Grid 才能使其工作。你可以在这里阅读文档:http://getbootstrap.com/css/ 这很容易理解。包装图像的divs 需要应用网格类。

    【讨论】:

    • 一旦我使用了网格系统,我会放弃自己的个性化尺寸吗?
    • 视情况而定。您可以保持浮动尺寸,但固定尺寸将使网格无法响应。我会删除您拥有的所有样式,并在您让基本网格按照您想要的方式工作后应用它们。
    猜你喜欢
    • 2014-01-10
    • 2016-07-24
    • 2013-12-11
    • 2016-03-04
    • 2020-12-12
    • 1970-01-01
    • 2016-10-07
    • 1970-01-01
    • 2016-12-30
    相关资源
    最近更新 更多