Skip to content

How to place 50%-sized Input elements next to each other, without wrapping? #576

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

You must be logged in to vote

This would be easier with a container around the inputs.

With flexbox:

<div class="group">
  <sl-input placeholder="First"></sl-input>
  <sl-input placeholder="Second"></sl-input>
</div>

<style>
  .group {
    border: dashed 2px silver; 
    display: flex;
    gap: 2rem;
  }

  .group sl-input {
    width: 50%;
  }
</style>

With CSS grid:

<div class="group">
  <sl-input placeholder="First"></sl-input>
  <sl-input placeholder="Second"></sl-input>
</div>

<style>
  .group {
    border: dashed 2px silver;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
</style>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@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