1

I have on page text and image under that text (multiple blocks). Sample : JsFiddle

<div class="container">
<div class="row">
    <div class="col-md-6">
        <img src="http://vignette4.wikia.nocookie.net/mrmen/images/5/52/Small.gif/revision/latest?cb=20100731114437" class="img-responsive"/>
        <br/>
        <h4>Test Text</h4>
    </div>
         <div class="col-md-6">
                         <img src="http://vignette4.wikia.nocookie.net/mrmen/images/5/52/Small.gif/revision/latest?cb=20100731114437" class="img-responsive"/>
        <br/>
        <h4>Test Text</h4>
         </div>
</div>

But on small screens text which is under image can be recognized by user as text for next image, which is wrong.

So i want to move text above the image on small screens.

Ideas that i have currently - add duplicate of existing text and add bootstrap classes hidden/visible to them. And switch text in order to size of screen.

But i hope there is more ellegant solution without adding same text again but in different possition

demo
  • 6,038
  • 19
  • 75
  • 149
  • try this: https://scotch.io/tutorials/reorder-css-columns-using-bootstrap – Luís P. A. May 19 '15 at 10:18
  • you mean when you're in small screen the text for the image will be display above the image? – Elle May 20 '15 at 06:35
  • In case someone is facing this problem with Wordpress + Elementor (Google brought me here), there is an easy solution: https://www.youtube.com/watch?v=GysPzwQMU1g – J0ANMM Aug 05 '21 at 07:48

2 Answers2

0

Try this..I edited your code

<div class="container">
<div class="row">
    <div class="col-md-6">
         <h4>Test Text</h4>
        <img src="http://vignette4.wikia.nocookie.net/mrmen/images/5/52/Small.gif/revision/latest?cb=20100731114437" class="img-responsive"/>
         <h4>Test Text</h4>
        <br/>

    </div>
         <div class="col-md-6">
                         <img src="http://vignette4.wikia.nocookie.net/mrmen/images/5/52/Small.gif/revision/latest?cb=20100731114437" class="img-responsive"/>
        <br/>

         </div>
</div>
Kevin Andrid
  • 1,963
  • 1
  • 15
  • 26
0

You can use media queries and display: flex property and order the elements.

CSS

@media (max-width:768px) {
.row .col-md-6 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

img {
  order: 2;
}

h4 {
  order: 1;
 }
}
m4n0
  • 29,823
  • 27
  • 76
  • 89