如何控制一个DIV框中的内容,当用户拉浏览器滚动条时,div中的内容可以随之滚动_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:51:09
Original
1461 people have browsed it

现在有一个居中的div 当内容高过这个div时 如何让浏览器出现滚动条并且滚动的是该DIV的内容 求代码


回复讨论(解决方案)

你可以让这个DIV超出高度出现滚动条,浏览器的滚动条控制的是整个文档,如果你加在文档上控制,那么整个页面一旦内容过大,那么你的滚动条究竟是控制DIV还是控制文档,容易混乱

所以,最好DIV加上限制,或者你自己定义滚动条来模拟

现在有一个居中的div 当内容高过这个div时 如何让浏览器出现滚动条并且滚动的是该DIV的内容 求代码




加上啥限制?这个居中div不可能让它设置overflow属性的 那么它就在div区域有滚动条效果了啊。
我要的就是这种效果如图

请问一下,问题解决了吗

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!