2个按钮样式居中div class=call-to-action a onclick=callCHATGPT class=btn btn-large href=# style=background-color #4cae4c; color #fff; font-weight bold; border-radius 5px; padding 10px 20px; bo
可以使用以下CSS代码将两个按钮样式居中:
.call-to-action { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; }
.btn { margin: 10px; }
.refresh-button { margin: 10px; background-color: #f44336; color: #fff; font-weight: bold; border-radius: 5px; padding: 10px 20px; border: none; box-shadow: none; text-decoration: none; cursor: pointer; }
注意:这里使用了flex布局,需要在父容器(class为“call-to-action”)上设置display为flex,并设置justify-content和align-items属性为center,使其水平和垂直居中。同时为了让两个按钮在一行上,需要设置flex-wrap属性为wrap。在按钮的样式中,为了让两个按钮间有间隔,使用了margin属性。
原文地址: https://www.cveoy.top/t/topic/1Za 著作权归作者所有。请勿转载和采集!