Button and input to have same height

Hi, I wanted to make the same height of button as of input field. I tried to do, but didnot find the solution. https://codepen.io/hamzacodepen951/pen/WNPqpMO
8 Replies
clevermissfox
clevermissfox12mo ago
Your button is extra tall because it's stretching to match the height of the other flex-item .coupon-input If you put an outline: 1px solid red on coupon-input you'll see. If you make your coupon-input fit the content that is inside, the button will stretch to match that height.
Hamza Naeem
Hamza NaeemOP12mo ago
ok I applied this code on .btn-coupon, problem is solved, but not sure if it is a good way to do it or not. padding: unset; margin-bottom: var(--space-medium);
clevermissfox
clevermissfox12mo ago
I think a better way is to make the coupon-input hug it’s content. You want your button to have padding and although it may look like it’s fixed on your screen, it’s a bandaid that will fall off on other browsers or as different screen sizes.
Hamza Naeem
Hamza NaeemOP12mo ago
I understand your point but I could not find any other way except padding: unset; margin-bottom: var(--space-medium); for coupon button. Could you please tell me how you would solve it?
No description
Hamza Naeem
Hamza NaeemOP12mo ago
oh I found the solution by removing margin-bottom from .text-input, and giving the same padding to input and button
Hamza Naeem
Hamza NaeemOP12mo ago
No description
clevermissfox
clevermissfox12mo ago
Yep see how making the .coupon-input( that wraps the input) hug the input and the button stretches to match the height of that element? That’s what I was talking about.Now it’s not a “magic-number” bandaid. Good work!
Hamza Naeem
Hamza NaeemOP12mo ago
Thank you so much
Want results from more Discord servers?
Add your server