Complete the code to add a light gray background to the section.
<section class="bg-[1]-200 p-6 rounded"> <h2 class="text-lg font-semibold">Welcome</h2> <p>This section has a soft background color.</p> </section>
The class bg-gray-200 adds a light gray background, which is subtle and easy on the eyes.
Complete the code to add a background image that covers the entire div.
<div class="h-48 bg-[1] bg-center bg-cover rounded-lg"> <p class="text-white p-4">Background image example</p> </div>
bg-fixed instead of setting the image URL.The class bg-[url('/images/bg.jpg')] sets the background image. Combined with bg-cover, it fills the div nicely.
Fix the error in the code to apply a semi-transparent black overlay on the background.
<div class="relative bg-blue-500 h-64 rounded"> <div class="absolute inset-0 bg-black [1]-50"></div> <div class="relative p-6 text-white"> <h3>Overlay Example</h3> </div> </div>
opacity-50 which affects the whole div including children.filter instead of opacity classes.The class bg-opacity-50 sets the background color transparency to 50%, creating a semi-transparent overlay.
Fill both blanks to create a responsive background color that changes on medium screens.
<div class="bg-[1]-300 md:bg-[2]-600 p-4 rounded"> <p>Responsive background color</p> </div>
md: prefix for responsive styles.The background is yellow on small screens and changes to a darker green on medium screens and larger.
Fill all three blanks to create a gradient background from blue to green with padding.
<section class="bg-gradient-to-[1] from-[2]-400 to-[3]-500 p-8 rounded-lg"> <h1 class="text-white text-2xl">Gradient Background</h1> </section>
The gradient goes from left (l) to right, starting with blue (blue) and ending with green (green).