Html 没有填充/边距的引导表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40258014/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap table with no padding/margin?
提问by Bj?rn C
I have this table:
我有这张表:
<table class="table table-bordered table-condensed col-md-12">
<thead>
<tr>
<td>Input</td>
</tr>
</thead
<tbody>
<tr>
<td><input type="text" /></td>
</tr>
</tbody>
</table>
I use Bootstrap as my framework and it looks like this:
我使用 Bootstrap 作为我的框架,它看起来像这样:
How can i stretch the input width & height to fit table cell?
如何拉伸输入宽度和高度以适合表格单元格?
I'm using CSS on input: width: 100%
I've tried CSS on td: padding: 0; margin: 0;
我在输入上使用 CSS:width: 100%
我在 td 上尝试过 CSS:padding: 0; margin: 0;
回答by Bj?rn C
As @Araz comment:
正如@Araz 评论:
tr td{
padding: 0 !important;
margin: 0 !important;
}
回答by Charantej Golla
Add padding:0
to td
. Place your style sheet below bootstrap.css
. so !important
is not required. if you use css in inline then !important
is required. .form-control
class is used to make input width 100%
of the cell.
添加padding:0
到td
. 将您的样式表放在下面bootstrap.css
。所以!important
不是必需的。如果您在内联使用 css,则!important
需要。.form-control
class 用于制作100%
单元格的输入宽度。
td{padding:0px !important}
.form-control{border-radius:0px !important;}
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet"/>
<table class="table table-bordered table-condensed col-md-12">
<thead>
<tr>
<td>Input</td>
</tr>
</thead
<tbody>
<tr>
<td><input type="text" class="form-control" /></td>
</tr>
</tbody>
</table>