Kevin Stock
Kevin Stock

Reputation: 516

Right align text in Bulma panel-block

How can I right align text in a panel-block? I've attempted using is-pulled-right on the span I wanted moved to right in this example:

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" integrity="sha256-qS+snwBgqr+iFVpBB58C9UCxKFhyL03YHpZfdNUhSEw=" crossorigin="anonymous">
</head>
<body>
    <nav class="panel">
        <a class="panel-block">
            <span>Foo</span>
            <span class="is-pulled-right">Bar</span>
        </a>
    </nav>
</body>

Codepen

I would like "Bar" moved to the right side of the panel-block. I've also attempted using a level with the contents of body as such:

    <nav class="panel">
        <a class="panel-block">
            <div class="level">
                <div class="level-left">
                    <span class="level-item">Foo</span>
                </div>
                <div class="level-right">
                    <span class="level-item">Bar</span>
                </div>
            </div>
        </a>
    </nav>

Codepen

but this does not change how it displays.

Upvotes: 0

Views: 2106

Answers (3)

bitFez
bitFez

Reputation: 332

I was pulling my hair out. @mitchell-long 's answer was the saving grace. I think the is-block argument in the class is what did it.

I was able to use levels too if anyone is interested.

Codepen

<a class="panel-block is-block" href="#">
  <nav class="level">
   <!-- Left side -->
   <div class="level-left">
    <p class="level-item">
      Foo
    </p>
    </div>
    <!-- Right side -->
    <div class="level-right">
      <p class="level-item">
         Bar
     </p>
    </div>
   </nav>
 </a>

Upvotes: 3

shubhu
shubhu

Reputation: 125

<div class="panel">
 <div class="panel-block is-justify-content-space-between">
  <p class="is-pulled-left">Foo</div>
  <p class="is-pulled-right">Bar</p>
 </div>
</div>

is-justify-content-space-between is what you need as per the docs

Upvotes: 1

Mitchell Long
Mitchell Long

Reputation: 37

I might try using the Bulma Columns.

This should work:

<nav class="panel">
  <a class="panel-block is-block">
    <div class="columns">
      <span class="column">foo</span>
      <span class="column has-text-right">bar</span>
    </div>
  </a>
</nav>

Upvotes: 1

Related Questions