我在我的頁面上有一個div,我想添加大量信息,因此我希望它可以滾動。我曾嘗試使用溢出:滾動;並出現滾動條,但不允許用戶向下滾動瀏覽內容。製作引導區div可滾動
網站:explorecanterbury.co.uk
HTML
<div class="info-div">
<div class="col-md-5 col-md-offset-7 col-xs-6 col-xs-offset-6" style="background-color:orange;">
<div class="close"><span class="close-btn"></spam></div>
<div class="col-md-10">
<h2 class="subtitle">Canterbury Cathedral</h1>
<img src="img/test.jpg" class="img-responsive">
<img src="img/test.jpg" class="img-responsive">
<p>St Augustine, the first Archbishop of Canterbury, arrived on the coast of Kent as a missionary to England in 597 AD. He came from Rome, sent by Pope Gregory the Great.</p>
<h2 class="subtitle">Find out more...</h1>
<p>SOCIAL MEDIA ICONS GO HERE</p>
<h2 class="subtitle">Related Attractions</h1>
<p>St Augustine, the first Archbishop of Canterbury, arrived on the coast of Kent as a missionary to England in 597 AD. He came from Rome, sent by Pope Gregory the Great.</p>
<p>St Augustine, the first Archbishop of Canterbury, arrived on the coast of Kent as a missionary to England in 597 AD. He came from Rome, sent by Pope Gregory the Great.</p>
</div>
</div>
</div>
CSS
.info-div {
position: relative;
margin-top: -100px;
z-index: 10;
height: 100%
max-height: 1340px;
overflow-y: scroll;
}
@font-face {
font-family: fundamental;
src: url(file://C:/Users/Sara/Documents/ExploreCanterbury/fonts/FUNDR___.TTF);
}
.close-btn {
background-image: url(file://C:/Users/Sara/Documents/ExploreCanterbury/img/close.png);
width:18px;
height:18px;
display: block;
}
.close{
margin-top: 20px;
}
.subtitle{
font-size: 30px;
margin: 0 0 30px;
font-family: fundamental;
}
沒有要滾動的內容。內容適合盒子的高度。 –
如果你去檢查元素,你可以看到它不會滾動時,內容溢出 – user3005003