Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make tiles wrap with Bulma CSS

Tags:

css

flexbox

bulma

I'm using the Bulma CSS framework with a Rails app. I have a long list of items and would like to display them in tiles. However, the tiles run off the screen instead of wrapping to the next line.

The Bulma Documentation doesn't address this issue. Since I am creating the tiles dynamically from a variable-length list, explicit nesting as described in their docs isn't so easy and I'd rather have it cleanly wrap to the next line.

Here's what my code basically looks like:

<div class="tile is-ancestor">   <div class="tile is-parent">     <% @my_list.each do |item| %>         <div class="tile is-child box">           <p><%= item %></p>         </div>     <% end %>   </div> </div> 

Since Bulma is based on flexbox, I would think there is some equivalent to flex-wrap: wrap;, but I couldn't find this option yet.


Update: It's possible to add the style flex-wrap: wrap;to the parent-container, but is there a Bulma-integrated class flag?

like image 883
martin-martin Avatar asked Mar 21 '17 15:03

martin-martin


People also ask

Is flex-wrap wrap Bulma?

In Bulma, the flex-wrap property is used as a helper. The flex-wrap property in Bulma allows the user to wrap the flex items either into a single line or wrapped onto multiple lines in a container. There are three classes available in Bulma that are used to wrap the flex items.

Is Bulma a good CSS framework?

Bulma is a free, open-source, modern CSS framework that can be used to build responsive web pages. It is considered one of the best CSS Frameworks for frontend development.

Is flex-wrap wrap?

The flex-wrap CSS property sets whether flex items are forced onto one line or can wrap onto multiple lines. If wrapping is allowed, it sets the direction that lines are stacked.

Is Flex direction row Bulma?

Combined with is-flex , all of the Flexbox CSS properties are available as Bulma helpers: flex-direction. flex-wrap. justify-content.


Video Answer


1 Answers

It seems that there is currently no class-flag in Bulma addressing this directly.

However, since Bulma is based on flexbox, it is possible to add the style flex-wrap: wrap; to the parent container to achieve the desired outcome.

like image 133
martin-martin Avatar answered Sep 20 '22 23:09

martin-martin