简体   繁体   English

当元素的宽度大于视口的宽度时…

[英]When width of an element is greater than the width of a viewport…


We use overflow property to specify whether scroll bars should be provided when content overflows element's box. 我们使用溢出属性来指定当内容溢出元素框时是否应提供滚动条。

Is there a similar property with which we could specify whether horizontal scroll bars should be provided when the width of an element is greater than the width of a viewport ( ie display area )? 是否存在类似的属性,当元素的宽度大于视口(即显示区域)的宽度时,是否可以指定是否提供水平滚动条?


thanx 感谢名单

您应该研究一下overflow-x css属性。

This would have to be done with JavaScript. 这必须使用JavaScript来完成。 You would most likely want to write a function that would re-size the element to have the same width as the viewport and set scroll:auto on that element to mimic the behavior you are looking for. 您很可能希望编写一个函数来重新调整元素的大小,使其具有与视口相同的宽度,并在该元素上设置scroll:auto以模仿您要查找的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM