Menu
CoddyTech

Opacity

Part of the Fundamentals section of Coddy's Tailwind CSS journey. Lesson 19 of 55.

A preview tile with opacity-50 is rendered at half opacity, including its children. The element still occupies its normal layout space and can receive interactions.

<div class="bg-black text-white p-4 opacity-100">Museum sample</div>

Opacity differs from hidden, which removes the box from layout. Do not make an interactive control invisible and leave it active; use the appropriate semantic disabled state when an action is unavailable. The numeric suffix is a percentage: opacity-80 means 80 percent opacity.

challenge icon

Challenge

Easy

Render the archived preview at 75 percent opacity while keeping its content.

Keep the supplied content and element IDs. Edit the HTML utility classes or the requested CSS. Click Run preview to refresh the preview after edits, then use Check/Run code to grade your work.

Try it yourself

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Practice studio</title><link rel="stylesheet" href="./styles.css"></head><body>
<div id="target" class="bg-black text-white p-4">Archived preview</div>
</body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals