Awesomeness
Awesomeness

Reputation: 2631

HAML - how to style a few elements side by side?

I have these few lines in HAML:

.badge-container
  =badge_image(nil, @dis, :vertical)
  %h4= @dis.name
  %p= @dis.description

right now they line up one below the other, but I would like to have the image line up on the left and the name and discription to the right of the image.

Is there a way to do that?

Thanks!

Upvotes: 1

Views: 475

Answers (1)

Dru
Dru

Reputation: 9820

I use the 1140 grid in my views. Using haml, I would achieve that with something like this:

.badge-container
  .row 
    .threecol
      =badge_image(nil, @dis, :vertical)
    .fivecol
        %h4= @dis.name
        %p= @dis.description

If you want to do this without a grid, you can visit the 1140 github page to inspect the classes used in the code above.

Upvotes: 1

Related Questions