CSS Padding Property: Complete Guide with Syntax and Examples

calender-iconPublished: 27 Jun 2025

clock-icon5-min read





INTRODUCTION

The outline-width property sets the thickness (width) of an element's outline. An outline is a line which is drawn around an element and is outside the border. It works together with outline-style and outline-color to define the complete outline around an element.

Possible values

The outline-width property can be specified in the following types.

  • [length] - Any CSS length units like rem, em, px etc.
  • Keyword Values
    • thin - The exact width is determined by the browser, but it's typically around 1px on desktop browsers.
    • medium - The exact width is determined by the browser, but it's typically around 3px on desktop browsers.
    • thick - The exact width is determined by the browser, but it's typically around 5px on desktop browsers.
NOTE:

When outline: none; is used, it remove the outline from an element entirely. The outline-width property computed value is 0

Syntax

outline-width: thin | medium | thick | [length];

Example

outline-width: 5px;    /* length unit */
outline-width: thin;   /* keyword value */

Frequently Asked Questions (FAQ)

What are the default values for outline-width?
The default value for outline-width in CSS is: medium. This means if you don't explicitly set outline-width, the browser uses a medium thickness — typically 3 pixels, but it can vary slightly by browser.

What's the difference between thin, medium, and thick in outline-width?
The outline-width keywords thin, medium, and thick in CSS represent browser-defined preset thicknesses for outlines.

Keyword Approximate Thickness Notes
thin ~1px Smallest visible outline
medium ~3px (default) Default thickness used by browsers
thick ~5px Thickest preset outline

These values are not exact, as they depend slightly on the browser and device resolution. They offer a simple way to apply consistent outline widths without needing to specify pixels.

Why is my outline-width not showing?
If your outline-width isn't showing in CSS, it’s likely due to one or more of the following common issues:

1. No outline-style Set (or set to none) - outline-width has no effect unless a visible outline-style is defined.

2. Outline Color is Transparent or Same as Background

3. Outline Overridden by Browser Styles - Some browsers have built-in styles for outlines that may override or conflict with yours. Use browser dev tools to inspect the actual computed styles.

4. Element Not Focused If you're applying outlines only on :focus, make sure the element is actually focused

Does outline-width affect layout or element size?
No, outline-width does not affect layout or element size in CSS. The outline is painted outside the element’s border edge and does not take up space in the layout. It won’t shift or resize nearby elements. The browser doesn’t account for it when calculating dimensions like offsetWidth or clientWidth.