【发布时间】:2018-08-11 14:57:59
【问题描述】:
我正在尝试将页面中心顶部的 4 个按钮与 css 水平对齐。这就是我所拥有的
button {
background-color: rgb(243, 243, 243);
border: 5px;
color: #000000;
padding: 15px 32px;
text-align: center;
margin: 4px 2px;
cursor: pointer;
-webkit-transition-duration: 0.6s;
transition-duration: 0.6s;
cursor: pointer;
display: block;
margin: auto;
}
每当我这样做时,按钮都会在中心对齐但也会垂直对齐,它们应该是水平的。我已经试过了:
显示:内联块; 代替 显示:块;
然后我的按钮变成水平对齐但不在我的页面顶部居中。
【问题讨论】:
-
你能提供你的 html 标记吗?你的按钮是使用
div还是button标签。
标签: html css button alignment center