How to place 50%-sized Input elements next to each other, without wrapping? #576
-
Hello, My approach for the 50% size – should this all be done using flex-basis, instead? <sl-form class="input-validation-type">
<sl-input type="email" class="input-half"></sl-input>
<sl-input type="url" class="input-half"></sl-input>
<br>
<sl-button type="primary" submit>Submit</sl-button>
</sl-form> .input-half::part(base) {
width: 50%;
} But how to have them not wrap? |
Beta Was this translation helpful? Give feedback.
Answered by
claviska
Nov 3, 2021
Replies: 1 comment 1 reply
-
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> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
oliveratgithub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would be easier with a container around the inputs.
With flexbox:
With CSS grid: