twitter-bootstrap - 按钮高度到行高

标签 twitter-bootstrap css twitter-bootstrap-3

您好,我正在使用 Bootstrap 3,我有这段代码:

<div class="row">
    <div class="col-sm-2 col-md-2 col-lg-2"><button>Öğrenci Projeleri</button></div>
    <div class="col-sm-2 col-md-2 col-lg-2"><button>İş Projeleri</button></div>
    <div class="col-sm-2 col-md-2 col-lg-2"><button>Grafik Tasarım</button></div>
    <div class="col-sm-2 col-md-2 col-lg-2"><button>Üniversite Başvuruları</button></div>
    <div class="col-sm-2 col-md-2 col-lg-2"><button>Danışmanlık</button></div>
    <div class="col-sm-2 col-md-2 col-lg-2"><button>&Fazlası</button></div>
</div>

按钮高度相等但按钮高度不等于行高,我想说的是按钮与行的顶部/底部之间存在间隙。

如果我增加按钮高度,行高会相应增加

如何在不增加行高的情况下消除间隙或增加按钮高度?我希望按钮顶部和底部边框触及行顶部和底部

谢谢

最佳答案

通常 btn 类(按钮 Bootstrap 的基类)有这样的边距或填充

.btn {
     -moz-user-select: none;
     background-image: none;
     border: 1px solid transparent;
     border-radius: 4px;
     cursor: pointer;
     display: inline-block;
     font-size: 15px;
     font-weight: normal;
     line-height: 1.42857;
     margin-bottom: 0;
     padding: 10px 15px;    /* this margin */
     text-align: center;
     vertical-align: middle;
     white-space: nowrap;
 }

您可以避免重新定义类 locallmente 或在您自己的 Bootstrap 版本中或通过分配更改常规设置的样式来干预单个按钮的规范,例如:

 <a class="btn btn-primary glyphicon glyphicon-plus" 
       href="yourRef" 
       style="padding: 3px 2px;"></a>

关于twitter-bootstrap - 按钮高度到行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32945753/

相关文章:

html - 将内联 css 移动到定义中

html - Bootstrap 容器或填充高度 100% 浏览器

twitter-bootstrap - 使用 bootstrap 形成组类之间不同的垂直间隙

ruby-on-rails - Heroku - therubyracer -v '0.11.0beta8' 失败

html - 在桌面设备上 Bootstrap 三列意外行为

html - 带有自定义图像的 Bootstrap 按钮中的文本和图标左对齐

javascript - 提交表单后将引导模式显示为 "thank you"

html - 无法更改 Bootstrap 主题元素颜色

css - 更改 Bootstrap 默认容器宽度

html - 嵌套时,使用 css 舍入图像边框不起作用