1
目前我使用下面的代碼來顯示滾動條:隱藏滾動條
div.productsTree{
height:300px;
overflow:scroll;
}
在使用這個CSS的滾動條是可見的所有的時間,這意味着,即使裏面的內容div不溢出。
如何在內容符合上述高度時隱藏它們?
目前我使用下面的代碼來顯示滾動條:隱藏滾動條
div.productsTree{
height:300px;
overflow:scroll;
}
在使用這個CSS的滾動條是可見的所有的時間,這意味着,即使裏面的內容div不溢出。
如何在內容符合上述高度時隱藏它們?
With overflow:auto;
。就這樣。
//Both x,y axis scroll
div.productsTree{
height:300px;
overflow:auto;
}
//only x axis scroll
div.productsTree{
height:300px;
overflow:auto;
overflow-y: hidden;
}
//only y axis scroll
div.productsTree{
height:300px;
overflow:auto;
overflow-x: hidden;
}
可能重複[CSS隱藏滾動條,如果不需要](http://stackoverflow.com/questions/18716863/css-hide-scroll-bar-if-not-needed) – The6P4C 2014-09-23 04:36:34