我用css很少,但我認爲以下應創建一個可滾動區域。相反,它似乎只是隱藏了所有不適合的文本,但無法滾動。行爲在Chrome/ie/firefox中看起來是一樣的,所以我猜測我只是在做一些錯誤的事情。DIV滾動條沒有出現
的index.html
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Foo</title>
</head>
<body>
<div id="history" class="scroll-area">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ac euismod nulla. Fusce enim tortor, elementum ut volutpat non, interdum ut nunc. Vestibulum placerat mi vel risus ultricies non bibendum urna vestibulum. Curabitur volutpat, turpis vel suscipit accumsan, lectus nibh blandit sem, ut elementum massa tortor quis augue. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis cursus lacus ac diam sollicitudin tempor. Vivamus at sagittis lacus. Donec augue neque, cursus in tristique at, mattis vitae eros.
</div>
</body>
</html>
的style.css
#history {
height: 200px;
width: 200px;
border: 1px solid #666;
padding: 8px;
}
.scroll-area {
overflow-style: auto;
overflow: hidden;
}
你嘗試過嗎?滾動區域{ overflow-y:scroll; 溢出:隱藏; } – proggrock 2013-04-25 17:17:18
謝謝大家。溢出:隱藏絕對是問題!欣賞所有超快速的反應。 – 2013-04-25 17:42:09