r/csshelp • • 5d 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

2 comments sorted by

1

u/Competitive-You-4442 5d 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.

1

u/Caroline_the_clown 2d ago

is there any way i can make the first item align to the right? I tried to do what you said but it kinda broke x x