【发布时间】:2020-02-10 15:39:03
【问题描述】:
我使用 Bootstrap 4 创建了一个如下开头的表。
Bootstrap 有一个内置类"table-sm",它可以最小化填充(可能还有其他东西),以使表格更适合小屏幕。
当我在下面的示例中应用此类而不是 "table-custom" 时,它会按预期工作,但我只想将它应用到移动(小)屏幕上。
因此,我创建了一个类 "table-custom" 并使用了下面的 CSS,但我无法让它工作。
谁能告诉我我还需要做什么来复制"table-sm" 类并将其仅限于移动(小)屏幕?
我的 HTML(开始):
<div class="table-responsive">
<table class="table table-custom table-hover">
<thead>
<tr>
我的 CSS:
@media (max-width: 767px) {
.table-custom>thead>tr>th,
.table-custom>thead>tr>td,
.table-custom>tbody>tr>th,
.table-custom>tbody>tr>td,
.table-custom>tfoot>tr>th,
.table-custom>tfoot>tr>td {
padding: 5px;
}
}
非常感谢,
迈克
【问题讨论】:
标签: css twitter-bootstrap html-table bootstrap-4 media