<!DOCTYPE html> <style> body { margin: 0; overflow: hidden; } .opacity { opacity: 0.8; } .box { left: 0; top: 200px; width: 200px; height: 200px; } .absolute { position: absolute; background: green; top: 100px; } .fixed { position: absolute; background: blue; } </style> <div class="opacity"> <div class="box absolute"></div> <div class="box fixed"></div> </div>