水平滚动CSS
我正在创建一个页面@ [链接已删除]
顶部的标题非常大(1600px)以适应宽显示器。将标题设置为 100% 宽度不起作用,因为旋转会产生一些奇怪的效果。
我将正文溢出-x 设置为隐藏,这样就不会出现水平滚动条。布局应适应正常的计算机分辨率。
问题是当您从分辨率非常小的设备(例如手机)访问时,或者如果您调整浏览器窗口的大小时。在这种情况下,水平滚动会非常有帮助,但它应该只滚动到足以看到图片,而不能再滚动。
这有道理吗?让我知道我需要澄清什么...
我尝试在正文和标题上组合 min-width 和 Overflow-x,但似乎找不到有效的解决方案。
谢谢! 杰夫
I am creating a page @ [link removed]
The header at the top is really large (1600px) to accomodate wide monitors. Setting the header to 100% width doesn't work, because the rotation produces some weird effects.
I set the body overflow-x to hidden, so that a horizontal scroll bar doesn't appear. The layout should accomodate normal computer resolutions.
The problem is when you visit from a device with very small resolution, e.g., a mobile phone, or if you resize your browser window. It would be very helpful to have horizontal scrolling in this case, but it should ONLY scroll enough to be able to see the picture, and no further.
Does this make sense? Let me know what I need to clarify...
I've tried doing combinations of min-width and overflow-x on the body and header, but can't seem to find a solution that works.
Thanks!
Jeff
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
定位手持设备,并设置 <将手持式样式表中的 code>overflow-x 更改为
auto
。或者使用 JavaScript 加载基于屏幕资源的样式表Use
<link rel="stylesheet" media="handheld" href="%%%.css" type="text/css" />
to target the handheld devices, and set theoverflow-x
toauto
in the handheld stylesheet. Or use JavaScript to load a stylesheet based on scren res我的答案是对 0x60 答案的补充。
我建议使用 CSS 媒体查询而不是 JavaScript 来检测屏幕宽度。
例如:
查看这些文章:
My answer is a complement to 0x60's answer.
I recommend using CSS Media Queries instead of JavaScript to detect screen widths.
For example:
Check these articles out: