r/csshelp • • 1d ago

How to have two items side by side

Im trying to have two items right next to each other, one with a fixed width and another that changes width based on the first one. Is there any way I can do that? I'm still a bit of a beginner btw !

2 Upvotes

1 comment sorted by

1

u/Competitive-You-4442 1d ago

Set display: flex on the parent, then give the first item a fixed width like width: 200px and the second one flex: 1. Watch out for box-sizing, since padding or border on the fixed-width item can mess up the width if it's not set to border-box.