在 iOS 上使用媒体查询时,我一直遇到表格不想更改(其他一切都应该按比例缩放)的问题,它在 Android 手机和平板电脑上完美运行,但在 iOS 上却不行。我尝试添加视口(viewport)元标记,但没有帮助。谁知道怎么修它? 部分媒体查询不起作用:
table, thead, tbody, th, td, tr {
display: block;
max-width:100%;
}
th{
display:none;
}
td {
border: none;
position: relative;
padding-left: 50%;
font-size: 1em;
background-color: #F6F7FB;
}
td:before {
position: absolute;
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
line-height: 4em;
vertical-align: middle;
font-weight: bold;
}
td:nth-of-type(2):before { content: "test"; }
td:nth-of-type(3):before { content: "test"; }
td:nth-of-type(4):before { content: "test"; }
td:nth-of-type(5):before { content: "test"; }
td:nth-of-type(6):before { content: "test"; }
td:nth-of-type(7):before { content: "test"; }
最佳答案
我不确定,但对我来说改变显示是不正确的。在大多数情况下,表格中的相对/绝对位置也不起作用。您是否可以将表格结构更改为带有显示表格和表格单元格的 div 结构?我总是这样做,当需要使一些大表响应并且没有问题时
关于html - 媒体查询不适用于 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42462248/