如何阻止我的 div 滚动?
How can I stop my div from scrolling?
我有一个响应式 div,它有 6 个选项(5 个文本块和 1 个按钮)。当此 div 达到移动 phone 屏幕尺寸时,div 会稍微 15px
滚动到它。我使用了很多 absolute
和 relative
定位,我相信这可能是我的问题,但我还是想不通。
我试过使用 overflow
和 overflow-y
的一堆组合,但无法得到它。
HTML:
<div class="about-preface">
<div class="preface-container">
<div class="preface-block">
<h4><i class="fa fa-user-plus"></i> Donor Acquisition</h4>
<p>Startup nonprofits and established organizations need to consistently add new donors in order to surpass fundraising goals.</p>
<p><a href="/about-fundraising-400#a">More on Donor Acquisition</a></p>
</div>
<!-- 5 more of these divs -->
</div>
</div>
Here is a JS Fiddle 里面什么都有。
您可能希望将 overflow: hidden
放在正文上以强制它包含您在 .about-preface
上的填充。
我有一个响应式 div,它有 6 个选项(5 个文本块和 1 个按钮)。当此 div 达到移动 phone 屏幕尺寸时,div 会稍微 15px
滚动到它。我使用了很多 absolute
和 relative
定位,我相信这可能是我的问题,但我还是想不通。
我试过使用 overflow
和 overflow-y
的一堆组合,但无法得到它。
HTML:
<div class="about-preface">
<div class="preface-container">
<div class="preface-block">
<h4><i class="fa fa-user-plus"></i> Donor Acquisition</h4>
<p>Startup nonprofits and established organizations need to consistently add new donors in order to surpass fundraising goals.</p>
<p><a href="/about-fundraising-400#a">More on Donor Acquisition</a></p>
</div>
<!-- 5 more of these divs -->
</div>
</div>
Here is a JS Fiddle 里面什么都有。
您可能希望将 overflow: hidden
放在正文上以强制它包含您在 .about-preface
上的填充。