html - 移动端表格水平滚动

标签 html css

我有代码:

	td{
		border: 1px #cccccc solid;
		white-space: nowrap;
	}
	div {
		max-width: 800px;
		overflow: auto;
	}
    <div>
    	<table>
    		<tr>
    			<td>Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap Nowrap</td>
    		</tr>
    	</table>
    </div>

它在 PC 上有效。然后在移动设备上设置元标记:

<meta name="viewport" content="width=device-width; initial-scale=1.0;  maximum-scale=1.0">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="collapsable" content="none">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

我的 table 超大屏幕。 我希望它显示表格的滚动宽度,并且表格中的所有内容都对移动设备友好!

最佳答案

在div标签上设置display:table属性

关于html - 移动端表格水平滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45921513/

相关文章:

html - 当字体丢失时,让元素上的样式在字体系列中具有继承值是否有效?

javascript - Materialise 表中的方形单元格

javascript - 鼠标悬停在弹出菜单上

css - 使用 CSS 速记属性时保留某些值不变

php - 从 blender 导出的 .X3D 文件具有黑色背景,我无法更改

javascript - 覆盖 Firefox 上的过渡延迟问题

javascript - IE7::SCRIPT1014: 无效字符

html - 调整 HTML 表格行之间的间距

html - localStorage eventHandler 未被调用

jquery - 动态分配 'active' 类