我正在尝试在应用程序的按钮上添加一些格式。当前按钮的代码如下所示:
.button {
margin-left: 15px;
background-color: #4BBB44;
border: 2px solid #2BB922;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
height: 20px;
padding: 15px;
}
<input id="Search" type="submit" value="Search" class="button">
我没有发布图片的声誉,但我想发布的屏幕截图显示了一个绿色框,中间有白色文本,上面写着“搜索”,但它在底部被截断了我该如何停止文本在底部被截断?
最佳答案
要么删除 height
属性,要么调整 line-height
使按钮中的文本垂直居中。例子
.button {
margin-left: 15px;
background-color: #4BBB44;
border: 2px solid #2BB922;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
height: 20px;
padding: 15px;
/* add this */
line-height: 0;
}
<input id="Search" type="submit" value="Search" class="button">
关于html - 按钮底部的文本被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47417422/