Skip to content

Right way to center a group of elements #575

Closed Answered by claviska
oliveratgithub asked this question in Help
Discussion options

You must be logged in to vote

The button group is display: inline-block by default, so this works:

<div style="text-align: center; border: dashed 2px silver;">
  <sl-button-group>
    <sl-button type="primary">Left</sl-button>
    <sl-button type="primary">Center</sl-button>
    <sl-button type="primary">Right</sl-button>
  </sl-button-group>
</div>

Another approach using flexbox:

<div style="display: flex; flex-direction: column; align-items: center; border: dashed 2px silver;">
  <sl-button-group>
    <sl-button type="primary">Left</sl-button>
    <sl-button type="primary">Center</sl-button>
    <sl-button type="primary">Right</sl-button>
  </sl-button-group>
</div>

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@oliveratgithub
Comment options

@claviska
Comment options

@oliveratgithub
Comment options

Answer selected by oliveratgithub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants