我一直在试图弄清楚为什么我的表格在 600 像素时无法正确显示在我的屏幕上。我在codepen上试过了,它工作正常,一定有什么东西阻止它在小屏幕上正确渲染。
(演示)
@media screen and (max-width:600px){
.sample{
background:blue;
}
table {
border: 0;
}
table thead {
display: none;
}
table tr {
margin-bottom: 10px;
display: block;
border-bottom: 2px solid #ddd;
width:100%;
}
table td {
display: block;
text-align: right;
font-size: 13px;
border-bottom: 1px dotted #ccc;
width:100%;
}
table td:last-child {
border-bottom: 0;
}
table td:before {
content: attr(data-label);
float: left;
text-transform: uppercase;
font-weight: bold;
}
}
这是我在 600 像素的网络浏览器上得到的。