Issue
all the images should be center aligned irrespective to its size. i have tried with below code, but it doesn't work for me. any help would be appreciated
.border-class{
border:1px solid #ddd;
padding:5px;
min-height:160px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="col-xs-3">
<div class="border-class">
<img src="http://www.w3schools.com/bootstrap/cinqueterre.jpg" class="img-responsive" alt="Cinque Terre"/>
</div>
</div>
<div class="col-xs-3">
<div class="border-class">
<img src="https://cdn2.iconfinder.com/data/icons/hawcons-gesture-stroke/32/icon_27_one_finger_click-128.png" class="img-responsive" alt="Cinque Terre"/>
</div>
</div>
<div class="col-xs-3">
<div class="border-class">
<img src="http://www.w3schools.com/bootstrap/cinqueterre.jpg" class="img-responsive" alt="Cinque Terre"/>
</div>
</div>
<div class="col-xs-3">
<div class="border-class">
<img src="http://www.w3schools.com/images/colorpicker.png" class="img-responsive" alt="Cinque Terre"/>
</div>
</div>
</div>
Solution
Simply you can use css flex, get properties from css flexbox add those to your class.
.border-class {
display: flex;
justify-content: center;
align-items: center;
}
Answered By - hashtag
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.