HTML CSS examples for CSS Layout:Absolute Position
Fix position: absolute element in a overflow: scroll element when scrolling
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .shadow_outer {<!-- ww w . j a v a 2s .c om--> position:relative; } .outer { background-color:Chartreuse; padding:31px; overflow-y:scroll; height:151px; white-space:nowrap; } .shadow { position:absolute; right:18px; width:21px; margin-right:-21px; height:151px; box-shadow:-11px 0px 21px gray; } </style> </head> <body> <h2>Lore</h2> <div class="shadow-outer"> <div class="outer"> <div class="shadow"></div> <img src="https://www.java2s.com/style/demo/Opera.png"> <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> <img src="https://www.java2s.com/style/demo/Safari.png"> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> </div> </div> </body> </html>