Back to CSS Notes
Topic #37

Outline Shorthand

The outline shorthand sets width, style and colour in one line. It is how focus states are styled in production stylesheets.


CSS Outline - Shorthand property

The outline property is a shorthand property for setting the following individual outline properties:

  • outline-width
  • outline-style (required)
  • outline-color

You can specify one, two, or three values from the list above. The order of the values does not matter.

CSS Outline Shorthand Examples

Here are some different outlines specified with the shorthand outline property:

A dashed outline.

A dotted red outline.

A 7px solid yellow outline.

A thick ridge pink outline.

Example

p.ex1
{outline: dashed;}
p.ex2
{outline: dotted red;}
p.ex3
{outline: 7px solid yellow;}
p.ex4
{outline: thick ridge pink;}

CSS Outline With Rounded Corners

Outlines can also have rounded corners.

The border-radius property is used to add rounded borders to an element.

Here are some different outlines with rounded corners:

A dashed outline.

A dotted red outline.

A 7px solid yellow outline.

A thick ridge pink outline.

Example

  p.ex1 {
  outline: dashed;
  border-radius: 8px;
}

p.ex2 {

  outline: dotted red;
  border-radius: 5px;
}

p.ex3 {

  outline: 7px solid yellow;
  border-radius: 5px;
}

p.ex4 {

  outline: thick ridge pink;
  border-radius: 8px;
}

p.ex5 {
  outline:
  thick solid green;
  border-radius: 10px;
}

Want to go beyond the notes?

Join Coding Now Tech Institute's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Outline Shorthand – FAQs

Quick answers about learning Outline Shorthand in CSS.

This free note from Coding Now Tech Institute explains Outline Shorthand in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on Coding Now Tech Institute, including Outline Shorthand, is 100% free with no signup required.
With focused practice, most students grasp Outline Shorthand in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now