css column expand to fit area

i have:
<div class="a">
<button>Btn</button>
<span>Text</span>
<button>Btn</button>
</div>
<div class="a">
<button>Btn</button>
<span>Text</span>
<button>Btn</button>
</div>
button {
width: 4em;
}
button {
width: 4em;
}
how can i make the span expand to fit the area given. *div is inside another element with a width.
6 Replies
Natejoestev
NatejoestevOP12mo ago
also, i might want to add more buttons around the span
clevermissfox
clevermissfox12mo ago
If you’re using flex, you could give the span a flex grow:1
b1mind
b1mind12mo ago
Or control it all with a grid-template 😄 grid-template-columns: auto 1fr auto;
b1mind
b1mind12mo ago
Grid can often times give you much more flexibility than flex 🥁 But also its going to want to fill space not shrink children by default
Natejoestev
NatejoestevOP12mo ago
exactly like #4 but btn span btn btn and the span expands
Want results from more Discord servers?
Add your server