css - 如何使用 CSS 降低按钮的高度?

标签 css html button

我是 CSS 新手。我有以下标签按钮样式。如何降低按钮的高度?我尝试更改它,但没有帮助。

我的代码:

.tag-btn {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    z-index: 5;
    position: relative;
    padding: 10px;
    line-height: 13px;
    margin: 0;
    height: 40px;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
    background-color: #F08080;
    border: none;
    color: #fff;
    box-shadow: none;
} 

谁能帮我解决这个问题?谢谢。

最佳答案

完全删除 height 并尝试调整 line-height

.tag-btn {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    z-index: 5;
    position: relative;
    padding: 10px;
    margin: 0;
    line-height: 5px;
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    -ms-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;
    background-color: #F08080;
    border: none;
    color: #fff;
    box-shadow: none;
} 

DEMO

关于css - 如何使用 CSS 降低按钮的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30049041/

相关文章:

html - 使超链接下划线出现在鼠标悬停时(目前相反)

css - 如何在 rails 中设置 form_for 的样式

html - 在 drupal 7 中将图像内容类型显示为网格?

javascript - 如何向按钮 javascript 添加事件监听器

javascript - 显示/隐藏内联表单

css - 如何使输入框和按钮在 bootstrap 中对齐?

php - 提取 Twitter 个人资料图像时的类 ="disconnect-collapsed"

python - 如何从html文件中删除所有不必要的标签和符号?

javascript - 如何使用 javascript 查找并单击网页上的特定按钮?

HTML 输入按钮 css-height 在 Safari 和 Chrome 上不起作用