我想显示一个表格(但我使用的是 div),因为表格很长,所以它会滚动溢出。我遇到的问题是我的 div 之间存在未知的差距。
这是片段:是什么导致列(div)之间出现不必要的间隙?
.mobile-cross-reference {
border: 1px solid #2980b9;
color: #333;
float: left;
margin: 2%;
width: 96%;
}
.m-grid-scroll {
overflow-x: scroll;
}
.m-grid-header {
background-color: #2980b9;
color: white;
text-align: center;
}
.m-grid-header,
.m-grid-row {
float: left;
width: 100%;
}
.m-grid-header-col {
background-color: #2980b9 !important;
}
.m-grid-row-inline {
background-color: transparent;
display: inline-block;
float: none;
white-space: nowrap;
}
.m-grid-col {
border-right: 1px solid #ccc;
float: left;
padding: 1% 0 1% 1%;
}
.m-grid-col:last-child {
border-right: 0;
}
.m-grid-col3 {
width: 31%;
}
.m-grid-inline {
display: inline-block;
float: none;
margin: 0;
}
<div class="mobile-cross-reference m-grid-scroll">
<div class="m-grid-header m-grid-row-inline">
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Bourns</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">BI Tech</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Dale/Vishay</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Philips/Mepco</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Murata</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Panasonic</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Spectrol</div>
<div class="m-grid-col m-grid-inline m-grid-col3 m-grid-header-col">Mil Spec</div>
</div>
<div class="m-grid-row m-grid-row-inline">
<div class="m-grid-col m-grid-inline m-grid-col3">Bourns</div>
<div class="m-grid-col m-grid-inline m-grid-col3">BI Tech</div>
<div class="m-grid-col m-grid-inline m-grid-col3">Dale/Vishay</div>
<div class="m-grid-col m-grid-inline m-grid-col3">Philips/Mepco</div>
<div class="m-grid-col m-grid-inline m-grid-col3">Murata</div>
<div class="m-grid-col m-grid-inline m-grid-col3">Panasonic</div>
<div class="m-grid-col m-grid-inline m-grid-col3">Spectrol</div>
<div class="m-grid-col m-grid-inline m-grid-col3">Mil Spec</div>
</div>
</div>