Skip to main content

CSS Outline - Shorthand property

The outline property is a shorthand for these individual properties: outline-width, outline-style (required), and outline-color.

You can give one, two, or three of these values, and the order does not matter.


CSS Outline Shorthand Examples

Here are some outlines written with the shorthand outline property.

Example

Four paragraphs use different shorthand outline values.

Prompt
An HTML page that demonstrates the outline shorthand property. In an internal <style> block, give paragraphs padding, then four classes using the shorthand: "dashed", "dotted red", "7px solid yellow", and "thick ridge pink". Add a labeled paragraph for each.
Output: complete HTML page

CSS Outline With Rounded Corners

Outlines can also have rounded corners. The border-radius property is used to round the corners.

Example

Each paragraph combines a shorthand outline with a border-radius for rounded corners.

Prompt
An HTML page that shows outlines with rounded corners using border-radius. In an internal <style> block, give paragraphs padding, then five classes each combining an outline shorthand with a border-radius: dashed/8px, dotted red/5px, 7px solid yellow/5px, thick ridge pink/8px, and thick solid green/10px. Add a labeled paragraph for each.
Output: complete HTML page