1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <style type="text/css"> 7 div{ 8 width: 300px; 9 height: 300px; 10 } 11 .box{ 12 margin: 100px auto; 13 position: relative; 14 } 15 .content{ 16 position: absolute; 17 background-color: blue; 18 left: -6px; 19 top: -6px; 20 z-index: 2; 21 } 22 .mark{ 23 position: absolute; 24 background-color: black; 25 right: -6px; 26 bottom: -6px; 27 z-index: 1;《定位级》 28 opacity: 0.5; 29 } 30 </style> 31 </head> 32 <body> 33 <div class="box"> 34 <div class="content"></div> 35 <div class="mark"></div> 36 </div> 37 </body> 38 </html>