I am trying to recreate the layout below:
The buttons sizes are the same (except one) regardless of the amount of text (including line breaks) inside the button. I am using Bootstrap 5 and have got close to this layout. I have made the buttons all the same width but the height differs. CSS below and fiddle here: https://jsfiddle.net/mfen723/g94tr1k7/9/
.btn-warning {
background: #e6deca;
color: #000;
border: #e6deca;
padding: 2rem;
border-radius: 50px;
width: 280px;
}
When I add a specific height to the button the link text is thrown off centre, so I don’t know how I can achieve the uniform button size as per the above image while keeping the layout responsive.
Any help much appreciated.
2
Answers
Add
height
to make them same size and use flexbox to center horizontally and vertically withalign-items
andjustify-content
.Like this:
Responsive design doesn’t mean that each button having same size regardless of the text. Definitely for different text, the button size change. What are the possiblities?
Obviously you can adjust your page as you wish. But the point is that, you have to give space to your text but you still maintain your page responsiveness. Hope it would be helpful.