[英]Make a scrollable child div independent of the scroll of parent
是你的意思嗎
<html lang="en"> <head> <title>Login page</title> <style>.custom{ width: 300px; height: 300px; padding: 20px; background-color: #EEE; border: 10px solid #CCC; margin: 30px; overflow: scroll; }.child{ height: 800px; width: 800px; background-color: #00F; } </style> </head> <body> </body> <div id="main" class="custom"> <div class="child"> child div </div> </div> </html>
將子 div/元素的溢出設置為 auto 以使其滾動:
溢出:自動;
對於滾動條拇指,您可能會發現這些很有用:
https://www.codegrepper.com/code-examples/css/custom+scrollbar+thumb+size
https://www.w3schools.com/howto/howto_css_custom_scrollbar.asp
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.