html - 如何将 HTML 表格放在行内 block 中,以便它们保持在一行中,而我只需要水平滚动?

标签 html css

我希望所有内容都在一行中表达,即使该行比屏幕宽度还宽,并且如果我想访问后面的元素,我只需要使用屏幕的滚动条来获得正确的位置。

我试过这个:

CSS:
.sth{
display: inline-block;
overflow-x: scroll;
}

它不起作用,有人可以帮忙吗? 谢谢:)

最佳答案

这就是您想要实现的目标吗?

div {
  max-width: 100%;
  overflow-x:scroll;
  white-space: nowrap;
}
<div>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
  in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>

关于html - 如何将 HTML 表格放在行内 block 中,以便它们保持在一行中,而我只需要水平滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42888286/

相关文章:

c# - 无法在 javascript 中获取 html 文本框的值

html - CSS - 具有样式和颜色的多个文本装饰

css - 自定义 Bootstrap 轮播控件上的 .active 类

html - 另一个带边距的 div 内的 div 高度为 100%

javascript - 带有 JS 和 JQuery 的 HTML 集成 Canvas

javascript - 未捕获的 TypeError : document. getElementById(...).submit 不是 HTMLDocument 中的函数。<anonymous>

jquery - 在鼠标悬停时显示 PNG 的不同部分

html - 无法将鼠标悬停在下拉菜单上

javascript - 将 jquery-ui 窗口的父元素设置为另一个元素

javascript - 粘性侧边栏行为异常