Z Index Layers
CSS
Hard
2 views
Problem Description
Create two overlapping boxes and bring one on top using z-index.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use position and z-index on both boxes.
Official Solution
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>meetcode</title>
<style>
.stage { position: relative; height: 140px; }
.a, .b { position: absolute; width: 180px; height: 90px; padding: 10px; color: #fff; border-radius: 12px; }
.a { background: #0b5; left: 20px; top: 20px; z-index: 1; }
.b { background: #1b263b; left: 60px; top: 50px; z-index: 2; }
</style>
</head>
<body>
<div class='stage'>
<div class='a'>meetcode A</div>
<div class='b'>meetcode B</div>
</div>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!