.features {
background-color: #0375b4;
padding: 40px 100px;
float: left;
width: 100%;
}
.features img {
width: 100px;
}
.features-content {
text-align: center;
}
.features-content h1 {
font-size: 24px;
color: #ffffff;
text-transform: uppercase;
margin-top: 10px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="features">
<div class="container">
<div class="row">
<div class="col-sm-4">
<div class="features-content">
<img src="https://image.flaticon.com/teams/slug/freepik.jpg" alt="Compass Logo">
<h1>Adventure</h1>
</div>
</div>
<div class="col-sm-4">
<div class="features-content">
<img src="https://image.flaticon.com/teams/slug/freepik.jpg" alt="Compass Logo">
<h1>Fun & Safety</h1>
</div>
</div>
<div class="col-sm-4">
<div class="features-content">
<img src="https://image.flaticon.com/teams/slug/freepik.jpg" alt="Compass Logo">
<h1>Impeccable Service</h1>
</div>
</div>
</div>
</div>
</div>
The items in the div are not vertically aligned . How do I properly align the items in the middle of the div? The picture in the last div is smaller than the pictures in other div so it has gone up. how to put all the pictures in the middle?
4
Answers
This can be achieved by specifying the desired image height (that of the other two images) to the
img
dom element.In this case, we apply the following CSS rules to
.features-content img
Complete example
Click the full screen button on the upper-right portion of the code snippet in order to see a wider view with items side-by-side; as shown in your example screenshot.
you can use following css property –
You can check in detail on here
If you are using Bootstrap 4 just add
d-flex align-items-center
torow
class to align vertically center.In your case,
the third column
h1
text length is grater when compare to other two so there is some issue in the design.Add vertical-align for images, and margin:0 auto; for div container.