How to make elements in Bulma box element full width in mobile view

Viewed 745

The bulma documentation has this example for a box with media objects:

<div class="box">
  <article class="media">
    <div class="media-left">
      <figure class="image is-64x64">
        <img src="https://bulma.io/images/placeholders/128x128.png" alt="Image">
      </figure>
    </div>
    <div class="media-content">
      <div class="content">
        <p>
          <strong>John Smith</strong> <small>@johnsmith</small> <small>31m</small>
          <br>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean efficitur sit amet massa fringilla egestas. Nullam condimentum luctus turpis.
        </p>
      </div>
    </div>
  </article>
</div>

I am new to Bulma and cannot figure out how to make the image and the paragraph texts fullwidth and one on top of the other in mobile view. I have tried to use column class but it didn't work. It is showing the image and text side by side regardless of the screen size.

1 Answers

Class .media, use a flexible rule, and you can independently move content under each other using a media query, setting rule flex-direction: column at breakpoint 480px (but you can specify any breakpoint).

@media (max-width: 480px) {
  .media {
    flex-direction: column;
  }
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">

<div class="box">
  <article class="media">
    <div class="media-left">
      <figure class="image is-64x64">
        <img src="https://bulma.io/images/placeholders/128x128.png" alt="Image">
      </figure>
    </div>
    <div class="media-content">
      <div class="content">
        <p>
          <strong>John Smith</strong> <small>@johnsmith</small> <small>31m</small>
          <br>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean efficitur sit amet massa fringilla egestas. Nullam condimentum luctus turpis.
        </p>
      </div>
    </div>
  </article>
</div>

Related