In a row there are 5 images and text below each image which is responsive.but when coded in bootstrap the images are overlapping when window is resized.
how can we align 5 images horizontally in a row with each having text below.
Here is model of images and text.Is there any way to make 5 images with text below in it responsive.
Bootstrap image and text side by side To create image and text side by side use the grid system property of bootstrap and create 2 columns of span 6-6. Put your image in one column and your text in another. On smaller devices, it will automatically align vertically.
This can be done by enclosing the image and text in an HTML “div”. Then make the position of div “relative” and that of text “absolute”. The absolute elements are positioned relative to their parent (div).
You might need to use <figure>
and <figcaption>
:
<figure>
<img />
<figcaption>Image</figcaption>
</figure>
Snippet
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<div class="container">
<div class="row text-center">
<div class="col-xs-2">
<figure>
<img src="http://placehold.it/100?text=IMG" alt="">
<figcaption>Hello</figcaption>
</figure>
</div>
<div class="col-xs-2">
<figure>
<img src="http://placehold.it/100?text=IMG" alt="">
<figcaption>Hello</figcaption>
</figure>
</div>
<div class="col-xs-2">
<figure>
<img src="http://placehold.it/100?text=IMG" alt="">
<figcaption>Hello</figcaption>
</figure>
</div>
<div class="col-xs-2">
<figure>
<img src="http://placehold.it/100?text=IMG" alt="">
<figcaption>Hello</figcaption>
</figure>
</div>
<div class="col-xs-2">
<figure>
<img src="http://placehold.it/100?text=IMG" alt="">
<figcaption>Hello</figcaption>
</figure>
</div>
<div class="col-xs-2">
<figure>
<img src="http://placehold.it/100?text=IMG" alt="">
<figcaption>Hello</figcaption>
</figure>
</div>
</div>
</div>
Preview:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With