我在网页中使用了overflow:auto,并且存在滚动问题。当我将光标放在内容上时,尝试滚动整个网页滚动,之前单独使用内容进行滚动,现在它不会发生。以下是我使用过的代码。
/* CSS Code */
.about-style{
max-width: 100%;
max-height: 100%;
background-color: #fff;
color: #000;
opacity: 0.7;
width: 150px;
height: 150px;
overflow: auto;
padding: 10px;
text-align: justify;
border-radius: 3px;
position: relative;
-webkit-overflow-scrolling:touch;
}
<!-- HTML Code -->
<div class="about-style">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
答案 0 :(得分:1)
仅当您的内容超过内容div的指定宽度和高度时,才会应用溢出。
正如您所提到的width: 550px; height: 450px;
<div class="about-style">
的内容并未超出上述规范。
在这种情况下,overflow:auto
和overflow:scroll
没有任何区别。
如果您想要滚动到<div class="about-style">
div,请减小其高度和宽度,以便内容溢出。
试试
width: 150px;
height: 150px;
你会得到你想象的卷轴。