<?xml version="1.0" encoding="utf-8"?>

CSS outline property

CSS outline property Bad Practice
CSS outline property Best Practice

An outline is a line wrapping up an element outside its borders. Its goal is to make the element prominent and capture users' attention. Unlike borders, the outline can take any size you want.

In CSS, we use the outline property and other various properties to adjust its style (e.g., dotted or solid), color, width, and offset. Outlines don't take up space — they go on the top of the container, overlapping with margin and nearby elements.

Pro Tip: Outlines should not necessarily be rectangular, but usually, they're of this shape.

Improve your UX & Product skills with interactive courses that actually work