我写了一段前端对吗,但是样式很奇怪。我使用 table 表格老显示数据,有个数据项是由两个按钮,和一个数据展示框组成的,但是在我搞好样式之后,我发现,这数据项中,数据文字样式一直是偏上的。使用元素 从 span 换成 div 又换成 p 都不起作用。请教一下经验丰富的朋友。
源码如下:
<table>
<thead class="thead">
<tr>
<th v-for="(title,index) in theadList">{{title}}</th>
</tr>
</thead>
<tbody class="product">
<tr v-for="(item,index) in fruitList" :key="item.id">
<td width="50"> <input type="checkbox"></td>
<td> <img :src="item.icon"/></td>
<td>{{item.price}}</td>
<td class="pro_num">
<button class="min_but">-</button>
<div class="num">{{item.num}}</div>
<button class="plus_but">+</button>
</td>
<td>{{item.num * item.price}}</td>
<td> <button>删除</button></td>
</tr>
</tbody>
<tbody class="empty">
<tr >
<td colspan="6">购物车空空如也</td>
</tr>
</tbody>
<tfoot class="foot">
<tr>
<td colspan="6">
<input type="checkbox" />全选
<span>总价:¥ </span>
<span>2400000</span>
<button>结算(600)</button>
</td>
</tr>
</tfoot>
</table>
样式的代码如下:
.table .product tr td .min_but{
display: inline-block;
border: 1px solid #333;
height: 30px;
width: 30px;
vertical-align: middle;
}
.table .product .pro_num .num{
display: inline-block;
border: none;
border-top: 1px solid #333;
border-bottom: 1px solid #333;
padding: 0;
width: 80px;
height: 30px;
vertical-align: middle;
text-align: center;
}
.table .product tr td .plus_but{
display: inline-block;
border: 1px solid #333;
height: 30px;
width: 30px;
vertical-align: middle;
}
效果如下截图:
这个红框内的数字,一直不能居中,一直偏上一线,也不知道怎么处理。请教一下大家,谢谢。