Bootstrap card whose image image is top/left, depending on column breakpoint?










0















Most Bootstrap 4 cards with images have either a .card-img-top or an image that goes somewhere else, like left, using additional/custom code.



Is there such thing as code for a single card whose image may be either at top of body or at left of body, depending on width?



See below, my current two different card types...



  • Top one is more standard with .card-img-top applied.

  • However, in certain scenarios on my site, I will want a more horizontal approach, with image on the left, achieved not with .card-img-top but with two additional columns, side-by-side. You also see this in the image.

enter image description here



Right now, I have had to write separate code to do this - one card type for vertical, the other for horizontal.



So I am curious - can I have a card whose image is either on top or on left depending on the size of the column containing it?



I'm trying to think it through, though...
At browser xs and sm, all columns would be 12 and vertical cards required.
But at browser md and lg, column widths will be varied according to mark-up needs as seen in the image.



Is this something that can be achieved using single-card code, or is there logic that is more complex than just this?



FYI...




  1. Here is the code for my vertical cards...







    Interviews








    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
    <!-- Card -->
    <div class="card rounded-0 w-100 bg-white shadow-sm">
    <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
    </a>
    <div class="card-body pb-2">
    <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
    </div>
    <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
    <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
    <span class="ml-1"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>
    </div>
    </div>
    <!-- Card -->
    </div>
    <!-- column -->


    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
    <!-- Card -->
    <div class="card rounded-0 w-100 bg-white shadow-sm">
    <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
    </a>
    <div class="card-body pb-2">
    <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
    </div>
    <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
    <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
    <span class="ml-1"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>
    </div>
    </div>
    <!-- Card -->
    </div>
    <!-- column -->


    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
    <!-- Card -->
    <div class="card rounded-0 w-100 bg-white shadow-sm">
    <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
    </a>
    <div class="card-body pb-2">
    <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
    </div>
    <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
    <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
    <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
    </div>
    </div>
    <!-- Card -->
    </div>
    <!-- column -->


    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
    <!-- Card -->
    <div class="card rounded-0 w-100 bg-white shadow-sm">
    <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
    </a>
    <div class="card-body pb-2">
    <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
    </div>
    <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
    <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
    <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
    </div>
    </div>
    <!-- Card -->
    </div>
    <!-- column -->









2.



And here is the code I'm trying for the horizontal-style cards...





<p><strong>Interviews</strong></p>

<div class="row">





<!-- column -->
<div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
<!-- Card -->
<div class="card rounded-0 bg-white shadow-sm">
<div class="row">

<div class="col-md-4">
<a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
<img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
</a>
</div>

<div class="col-md-8 pl-0 py-2">
<div class="card-block">
<h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
<img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
<span class="small pl-0 ml-0"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>


</div>
</div>

</div><!-- end .row -->
</div>
<!-- Card -->
</div>
<!-- column -->





<!-- column -->
<div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
<!-- Card -->
<div class="card rounded-0 bg-white shadow-sm">
<div class="row">

<div class="col-md-4">
<a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
<img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
</a>
</div>

<div class="col-md-8 pl-0 py-2">
<div class="card-block">
<h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
<img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
<span class="small pl-0 ml-0"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>




</div>
</div>

</div><!-- end .row -->
</div>
<!-- Card -->
</div>
<!-- column -->





<!-- column -->
<div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
<!-- Card -->
<div class="card rounded-0 bg-white shadow-sm">
<div class="row">

<div class="col-md-4">
<a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
<img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
</a>
</div>

<div class="col-md-8 pl-0 py-2">
<div class="card-block">
<h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
<img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
<span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





</div>
</div>

</div><!-- end .row -->
</div>
<!-- Card -->
</div>
<!-- column -->





<!-- column -->
<div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
<!-- Card -->
<div class="card rounded-0 bg-white shadow-sm">
<div class="row">

<div class="col-md-4">
<a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
<img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
</a>
</div>

<div class="col-md-8 pl-0 py-2">
<div class="card-block">
<h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
<img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
<span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





</div>
</div>

</div><!-- end .row -->
</div>
<!-- Card -->
</div>
<!-- column -->
</div>




</div>


(I am endeavouring to make the images "cover" style, where they fill the available space.
Images on a vertical card should retain a landscape orientation, images on a horizontal card should be square. NB - there is currently an issue with my horizontal-card code which introduces a border/margin below the left image when the text on the right is longer than it.)










share|improve this question




























    0















    Most Bootstrap 4 cards with images have either a .card-img-top or an image that goes somewhere else, like left, using additional/custom code.



    Is there such thing as code for a single card whose image may be either at top of body or at left of body, depending on width?



    See below, my current two different card types...



    • Top one is more standard with .card-img-top applied.

    • However, in certain scenarios on my site, I will want a more horizontal approach, with image on the left, achieved not with .card-img-top but with two additional columns, side-by-side. You also see this in the image.

    enter image description here



    Right now, I have had to write separate code to do this - one card type for vertical, the other for horizontal.



    So I am curious - can I have a card whose image is either on top or on left depending on the size of the column containing it?



    I'm trying to think it through, though...
    At browser xs and sm, all columns would be 12 and vertical cards required.
    But at browser md and lg, column widths will be varied according to mark-up needs as seen in the image.



    Is this something that can be achieved using single-card code, or is there logic that is more complex than just this?



    FYI...




    1. Here is the code for my vertical cards...







      Interviews








      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
      <!-- Card -->
      <div class="card rounded-0 w-100 bg-white shadow-sm">
      <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
      </a>
      <div class="card-body pb-2">
      <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
      </div>
      <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
      <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
      <span class="ml-1"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>
      </div>
      </div>
      <!-- Card -->
      </div>
      <!-- column -->


      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
      <!-- Card -->
      <div class="card rounded-0 w-100 bg-white shadow-sm">
      <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
      </a>
      <div class="card-body pb-2">
      <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
      </div>
      <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
      <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
      <span class="ml-1"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>
      </div>
      </div>
      <!-- Card -->
      </div>
      <!-- column -->


      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
      <!-- Card -->
      <div class="card rounded-0 w-100 bg-white shadow-sm">
      <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
      </a>
      <div class="card-body pb-2">
      <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
      </div>
      <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
      <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
      <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
      </div>
      </div>
      <!-- Card -->
      </div>
      <!-- column -->


      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
      <!-- Card -->
      <div class="card rounded-0 w-100 bg-white shadow-sm">
      <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
      </a>
      <div class="card-body pb-2">
      <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
      </div>
      <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
      <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
      <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
      </div>
      </div>
      <!-- Card -->
      </div>
      <!-- column -->









    2.



    And here is the code I'm trying for the horizontal-style cards...





    <p><strong>Interviews</strong></p>

    <div class="row">





    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
    <!-- Card -->
    <div class="card rounded-0 bg-white shadow-sm">
    <div class="row">

    <div class="col-md-4">
    <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
    </a>
    </div>

    <div class="col-md-8 pl-0 py-2">
    <div class="card-block">
    <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
    <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
    <span class="small pl-0 ml-0"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>


    </div>
    </div>

    </div><!-- end .row -->
    </div>
    <!-- Card -->
    </div>
    <!-- column -->





    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
    <!-- Card -->
    <div class="card rounded-0 bg-white shadow-sm">
    <div class="row">

    <div class="col-md-4">
    <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
    </a>
    </div>

    <div class="col-md-8 pl-0 py-2">
    <div class="card-block">
    <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
    <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
    <span class="small pl-0 ml-0"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>




    </div>
    </div>

    </div><!-- end .row -->
    </div>
    <!-- Card -->
    </div>
    <!-- column -->





    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
    <!-- Card -->
    <div class="card rounded-0 bg-white shadow-sm">
    <div class="row">

    <div class="col-md-4">
    <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
    </a>
    </div>

    <div class="col-md-8 pl-0 py-2">
    <div class="card-block">
    <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
    <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
    <span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





    </div>
    </div>

    </div><!-- end .row -->
    </div>
    <!-- Card -->
    </div>
    <!-- column -->





    <!-- column -->
    <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
    <!-- Card -->
    <div class="card rounded-0 bg-white shadow-sm">
    <div class="row">

    <div class="col-md-4">
    <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
    <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
    </a>
    </div>

    <div class="col-md-8 pl-0 py-2">
    <div class="card-block">
    <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
    <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
    <span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





    </div>
    </div>

    </div><!-- end .row -->
    </div>
    <!-- Card -->
    </div>
    <!-- column -->
    </div>




    </div>


    (I am endeavouring to make the images "cover" style, where they fill the available space.
    Images on a vertical card should retain a landscape orientation, images on a horizontal card should be square. NB - there is currently an issue with my horizontal-card code which introduces a border/margin below the left image when the text on the right is longer than it.)










    share|improve this question


























      0












      0








      0








      Most Bootstrap 4 cards with images have either a .card-img-top or an image that goes somewhere else, like left, using additional/custom code.



      Is there such thing as code for a single card whose image may be either at top of body or at left of body, depending on width?



      See below, my current two different card types...



      • Top one is more standard with .card-img-top applied.

      • However, in certain scenarios on my site, I will want a more horizontal approach, with image on the left, achieved not with .card-img-top but with two additional columns, side-by-side. You also see this in the image.

      enter image description here



      Right now, I have had to write separate code to do this - one card type for vertical, the other for horizontal.



      So I am curious - can I have a card whose image is either on top or on left depending on the size of the column containing it?



      I'm trying to think it through, though...
      At browser xs and sm, all columns would be 12 and vertical cards required.
      But at browser md and lg, column widths will be varied according to mark-up needs as seen in the image.



      Is this something that can be achieved using single-card code, or is there logic that is more complex than just this?



      FYI...




      1. Here is the code for my vertical cards...







        Interviews








        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->


        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->


        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->


        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->









      2.



      And here is the code I'm trying for the horizontal-style cards...





      <p><strong>Interviews</strong></p>

      <div class="row">





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
      <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>


      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
      <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>




      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
      <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
      <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->
      </div>




      </div>


      (I am endeavouring to make the images "cover" style, where they fill the available space.
      Images on a vertical card should retain a landscape orientation, images on a horizontal card should be square. NB - there is currently an issue with my horizontal-card code which introduces a border/margin below the left image when the text on the right is longer than it.)










      share|improve this question
















      Most Bootstrap 4 cards with images have either a .card-img-top or an image that goes somewhere else, like left, using additional/custom code.



      Is there such thing as code for a single card whose image may be either at top of body or at left of body, depending on width?



      See below, my current two different card types...



      • Top one is more standard with .card-img-top applied.

      • However, in certain scenarios on my site, I will want a more horizontal approach, with image on the left, achieved not with .card-img-top but with two additional columns, side-by-side. You also see this in the image.

      enter image description here



      Right now, I have had to write separate code to do this - one card type for vertical, the other for horizontal.



      So I am curious - can I have a card whose image is either on top or on left depending on the size of the column containing it?



      I'm trying to think it through, though...
      At browser xs and sm, all columns would be 12 and vertical cards required.
      But at browser md and lg, column widths will be varied according to mark-up needs as seen in the image.



      Is this something that can be achieved using single-card code, or is there logic that is more complex than just this?



      FYI...




      1. Here is the code for my vertical cards...







        Interviews








        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->


        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->


        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->


        <!-- column -->
        <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-3 p-2">
        <!-- Card -->
        <div class="card rounded-0 w-100 bg-white shadow-sm">
        <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
        <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="card-img-top img-fluid rounded-0"><!-- had w-100 -->
        </a>
        <div class="card-body pb-2">
        <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
        </div>
        <div class="card-footer bg-white text-muted small pt-0 border-top-0 px-3">
        <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
        <span class="ml-1"><a href="/source/moconews/" class="text-muted">moconews</a></span>
        </div>
        </div>
        <!-- Card -->
        </div>
        <!-- column -->









      2.



      And here is the code I'm trying for the horizontal-style cards...





      <p><strong>Interviews</strong></p>

      <div class="row">





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/article_drum.jpeg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="http://www.thedrum.com/news/2016/11/29/something-going-have-change-quickly-fts-elli-papadaki-programmatic-transparency" class="text-dark">‘Something is going to have to change quickly,’ FT’s Elli Papadaki on programmatic transparency</a></h6>
      <img src="http://www.example.com/wp-content/uploads/fav_drum.png" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/the-drum/" class="text-muted">The Drum</a></span>


      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="https://gigaom.com/2012/02/28/419-interview-ft-ceo-denies-sale-and-braves-strike-ahead-of-social-launch/" class="text-dark">Interview: FT CEO Denies Sale And Braves Strike Ahead Of Social Launch</a></h6>
      <img src="http://www.example.com/wp-content/uploads/favicon_pc.gif" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/paidcontent/" class="text-muted">paidContent</a></span>




      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/john-ridding-o.png" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" class="text-dark">Interview: Digital’s Second Age Begins Now, FT CEO Says</a></h6>
      <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/08/08/419-interview-digitals-second-age-begins-now-ft-ceo-says/" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->





      <!-- column -->
      <div class="d-flex align-items-stretch col-xs-12 col-sm-4 col-md-6 col-lg-6 p-2">
      <!-- Card -->
      <div class="card rounded-0 bg-white shadow-sm">
      <div class="row">

      <div class="col-md-4">
      <a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/">
      <img src="http://www.example.com/image/http://www.example.com/wp-content/uploads/rob-grimshaw-official-o-640x443.jpg" class="img-fluid rounded-0" style="object-fit:cover"><!-- had w-100 -->
      </a>
      </div>

      <div class="col-md-8 pl-0 py-2">
      <div class="card-block">
      <h6 class="card-title"><a href="https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" class="text-dark">Interview: Financial Times’ Grimshaw: ‘App Stores Are Not A Panacea’</a></h6>
      <img src="https://www.google.com/s2/favicons?domain=https://gigaom.com/2011/06/07/419-interview-financial-times-grimshaw-app-stores-are-not-a-panacea/" width="17" class="rounded-circle">
      <span class="small pl-0 ml-0"><a href="/source/moconews/" class="text-muted">moconews</a></span>





      </div>
      </div>

      </div><!-- end .row -->
      </div>
      <!-- Card -->
      </div>
      <!-- column -->
      </div>




      </div>


      (I am endeavouring to make the images "cover" style, where they fill the available space.
      Images on a vertical card should retain a landscape orientation, images on a horizontal card should be square. NB - there is currently an issue with my horizontal-card code which introduces a border/margin below the left image when the text on the right is longer than it.)







      css twitter-bootstrap responsive-design bootstrap-4






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 13:58







      Robert Andrews

















      asked Nov 12 '18 at 13:50









      Robert AndrewsRobert Andrews

      3791420




      3791420






















          1 Answer
          1






          active

          oldest

          votes


















          0














          If i understood your question correctly ( was a long read :) ) , you could make use of the flex-direction property.



          I made a simple example for you. First, the columns are one after the other ( horizontally ) and the contents inside the same.



          Then after a desired breaking point ( 600px ) i made the columns to have a column direction.



          You could also play around with bootstrap classes and you might get the same result.



          See snippet below or jsFiddle






          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>








          share|improve this answer

























          • Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

            – Robert Andrews
            Nov 12 '18 at 20:57










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263602%2fbootstrap-card-whose-image-image-is-top-left-depending-on-column-breakpoint%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If i understood your question correctly ( was a long read :) ) , you could make use of the flex-direction property.



          I made a simple example for you. First, the columns are one after the other ( horizontally ) and the contents inside the same.



          Then after a desired breaking point ( 600px ) i made the columns to have a column direction.



          You could also play around with bootstrap classes and you might get the same result.



          See snippet below or jsFiddle






          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>








          share|improve this answer

























          • Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

            – Robert Andrews
            Nov 12 '18 at 20:57















          0














          If i understood your question correctly ( was a long read :) ) , you could make use of the flex-direction property.



          I made a simple example for you. First, the columns are one after the other ( horizontally ) and the contents inside the same.



          Then after a desired breaking point ( 600px ) i made the columns to have a column direction.



          You could also play around with bootstrap classes and you might get the same result.



          See snippet below or jsFiddle






          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>








          share|improve this answer

























          • Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

            – Robert Andrews
            Nov 12 '18 at 20:57













          0












          0








          0







          If i understood your question correctly ( was a long read :) ) , you could make use of the flex-direction property.



          I made a simple example for you. First, the columns are one after the other ( horizontally ) and the contents inside the same.



          Then after a desired breaking point ( 600px ) i made the columns to have a column direction.



          You could also play around with bootstrap classes and you might get the same result.



          See snippet below or jsFiddle






          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>








          share|improve this answer















          If i understood your question correctly ( was a long read :) ) , you could make use of the flex-direction property.



          I made a simple example for you. First, the columns are one after the other ( horizontally ) and the contents inside the same.



          Then after a desired breaking point ( 600px ) i made the columns to have a column direction.



          You could also play around with bootstrap classes and you might get the same result.



          See snippet below or jsFiddle






          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>








          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>





          .col-4 
          flex-direction: row;
          display: flex;


          @media only screen and (max-width: 600px)
          .col-4
          flex-direction: column;


          <div class="row">
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          <div class="col-4">
          <img src="https://via.placeholder.com/150">
          <div class="text">
          some text
          </div>
          </div>
          </div>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 12 '18 at 14:19

























          answered Nov 12 '18 at 14:13









          Mihai TMihai T

          10.9k1723




          10.9k1723












          • Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

            – Robert Andrews
            Nov 12 '18 at 20:57

















          • Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

            – Robert Andrews
            Nov 12 '18 at 20:57
















          Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

          – Robert Andrews
          Nov 12 '18 at 20:57





          Maybe seem to kind of work. I need to put a .card inside the column. And I'm actually unclear about the interplay between col-* class and @media stuff. ie. My current vertical cards take col-xs-12 col-sm-6 col-md-6 col-lg-3 so what on earth would I do?

          – Robert Andrews
          Nov 12 '18 at 20:57

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263602%2fbootstrap-card-whose-image-image-is-top-left-depending-on-column-breakpoint%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kleinkühnau

          Makov (Slowakei)

          Deutsches Schauspielhaus