Menu
CoddyTech

Focus Feedback

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

A text input with focus:outline-2 focus:outline-solid gains a 2-pixel solid outline when it receives focus. Focus identifies the active control for keyboard and pointer users; it is not the same as hover.

<input aria-label="Sample" class="focus:outline-2 focus:outline-solid">

Preserve a visible focus indicator. The focus: variant applies to any focused state; focus-visible: follows the browser heuristic for when an indicator is needed, commonly keyboard navigation. Bracket widths such as outline-[5px] allow an exact outline thickness.

challenge icon

Challenge

Medium

Give the supplied Search control no custom outline at rest and a 3-pixel solid black outline when focused. Keep the accessible label.

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>
<button id="target" class="outline-black">Search</button>
</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