作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 CSS 在页面中央顶部水平对齐 4 个按钮。这就是我的
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;
}
每当我这样做时,按钮都会在中心对齐,但也会垂直对齐,它们应该是水平的。我已经试过了:
显示:内联 block ;代替显示: block ;
但随后我的按钮水平对齐但不在我的页面顶部居中。
最佳答案
最好的方法是在容器中使用 text alig
,如下所示:
.container {
text-align: center;
}
<div class='container'>
<button>MyBtn1</button>
<button>MyBtn1</button>
<button>MyBtn1</button>
</div>
关于html - 我想水平对齐按钮并使用 css 将它们居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49085308/
使用登录后,我想吐出用户名。 但是,当我尝试单击登录按钮时, 它给了我力量。 我看着logcat,但是什么也没显示。 这种编码是在说。 它将根据我在登录屏幕中输入的名称来烘烤用户名。 不会有任何密码。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎是题外话,因为它缺乏足够的信息来诊断问题。 更详细地描述您的问题或include a min
我是一名优秀的程序员,十分优秀!