使用flex布局并设置display属性为flex,然后在父级容器中设置justify-content属性。例如:
HTML代码:
CSS代码:
.button-container {
display: flex;
justify-content: space-around;
}
.button-container button {
background-color: #ccc;
border: none;
padding: 10px 20px;
}
在上面的示例中,父级容器.button-container使用了flex布局,并设置了justify-content: space-around属性。这会将三个按钮平均分布在容器中,相互之间具有相同的距离。
上一篇:按钮上的“禁用”似乎没有生效。
下一篇:按钮上锚点之间的文本未显示