简体   繁体   中英

Bootstrap responsive image height

I need the images be in the same height and at the same time responsive, but I don't understand how to do this.

<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="container">
    <div class="row" style="text-align: center">
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <img style="width : 100%" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-frc3/t1/1743484_1417876895127107_960615052_n.jpg" alt="" />
        </div>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <img style="width : 100%" src="https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash3/t1/1016354_762185537132820_936517474_n.jpg" alt=""  />
        </div>
    </div>
</div>
</div>

http://jsfiddle.net/G26mN/

try this one:

img {
width: inherit;  /* Make images fill their parent's space. Solves IE8. */
max-width: 100%; /* Add !important if needed. */
height: auto;    /* Add !important if needed. */
}
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <div class="container">
        <div class="row" style="text-align: center">
            <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <img class="img-responsive" src="https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-frc3/t1/1743484_1417876895127107_960615052_n.jpg" alt="" />
        </div>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
            <img class="img-responsive" src="https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-ash3/t1/1016354_762185537132820_936517474_n.jpg" alt=""  />
           </div>
        </div>
    </div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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