Complete the code to make the container positioned relative.
<div class="[1] bg-blue-200 p-4"> <p>This box is relative.</p> </div>
The relative class sets the element's position to relative, allowing absolutely positioned children to be placed relative to it.
Complete the code to position the box absolutely inside its relative parent.
<div class="relative bg-gray-100 p-6"> <div class="[1] bg-red-400 p-2"> Absolute box </div> </div>
The absolute class positions the element absolutely relative to the nearest positioned ancestor, which is the parent with relative.
Fix the error in the code to make the box fixed at the top right corner.
<div class="[1] top-0 right-0 bg-green-300 p-3"> Fixed box </div>
The fixed class positions the element relative to the viewport, so it stays at the top right corner even when scrolling.
Fill both blanks to position the child absolutely at the bottom left inside the relative parent.
<div class="[1] bg-yellow-100 p-5"> <div class="[2] bottom-0 left-0 bg-yellow-400 p-2"> Bottom left box </div> </div>
The parent needs relative positioning so the child with absolute can be placed at bottom left inside it.
Fill all three blanks to create a fixed header with relative container and absolute logo inside.
<header class="[1] bg-gray-800 text-white p-4"> <div class="[2] max-w-7xl mx-auto"> <div class="[3] top-0 left-0 p-2"> Logo </div> <nav> Navigation </nav> </div> </header>
The header is fixed to stay on top. Inside it, the container is relative so the logo can be absolute positioned at top left.