Issue
I'm making school project in html and css, and all the upper parts above the buttons are centered and responsive, but the buttons are not centered (I had to change the width to 60%) and they are not responsive, Any help would be appreciated.
Here is the css code:
.Sports-type{
padding: 10px;
width: 60%;
margin: auto;
text-align: center;
display: grid;
grid-template-columns: auto auto auto;
}
I tried to use different display commands and play with the width, padding, and margin, But not results.
Solution
You can replace the display: grid
with display: flex
to center the buttons and make them responsive.
.Sports-type {
padding: 10px;
width: 60%;
margin: auto;
text-align: center;
display: flex;
flex-wrap: wrap;
justify-content: space-around; /* Adjust as needed */
}
.Sports-type button {
width: calc(33.33% - 20px); /* Adjust the width and spacing as needed */
margin: 10px; /* Adjust the margin as needed */
}
Answered By - Navam Ajabale
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.