1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<html> <head> <style> div { width: 100px; height: 100px; position:relative; } #first { background-color: red; z-index: 1; } #second { top: -50px; background-color: green; z-index: 1; } </style> </head> <body> <div id="first"></div> <div id="second"></div> </body> </html>