Favorites

CSS <line-width> Data Type

<line-width>
CSS Data TypeThis data type is supported by all modern browsers.
Updated 21st November 2026

The <line-width> data type is the thickness of a line, written as a length or the keyword thin, medium or thick, used by borders and outlines.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

Description

The <line-width> CSS data type represents the thickness of a line, such as a border, an outline or a column rule. It is used by border-width and its longhands, the border shorthands, outline-width and column-rule-width.

A <line-width> is either a non-negative <length>, such as 2px or 0.1em, or one of the keywords thin, medium and thick. The specification defines the keywords as 1px, 3px and 5px respectively, and modern browsers follow that. medium is the initial value of border-width, which is why border: solid on its own gives a 3px border. Percentages are not allowed.

Browsers round line widths to whole device pixels, so a very thin value such as 0.3px is usually drawn as one device pixel (or not at all when it is below that), and values never fall below that minimum once a visible border style is set.

Examples:

.subtle  { border: thin solid #e2e8f0; }
.default { border-style: solid; }          /* medium (3px) */
.heavy   { border: thick double #0f172a; }
.focus   { outline: 0.2em solid #2563eb; }

Interactive Demo

Border
Demo Code
HTML Code
<div class="demo-element">Border</div>
CSS Code
.demo-element {
	width: 200px;
	padding: 20px;
	border: 3px solid #4361ee;
	background: #e7ecff;
	color: #1b1f3b;
	text-align: center;
	border-width: thin;
}

Syntax

<line-width> = <length [0,∞]> | thin | medium | thick

Values

  • <length>A non-negative length, such as 2px or 0.1em.
  • thinA thin line. Equivalent to 1px.
  • mediumA medium line. Equivalent to 3px. This is the initial value for border widths.
  • thickA thick line. Equivalent to 5px.

Example

<div class="wrap">
<h1>CSS &lt;line-width&gt; examples</h1>
<div class="grid">
<div class="card">
<div class="box thin">thin</div>
<div class="label">border-width: thin (1px)</div>
</div>
<div class="card">
<div class="box medium">medium</div>
<div class="label">border-width: medium (3px)</div>
</div>
<div class="card">
<div class="box thick">thick</div>
<div class="label">border-width: thick (5px)</div>
</div>
<div class="card">
<div class="box len">10px</div>
<div class="label">border-width: 10px</div>
</div>
<div class="card">
<div class="box em">0.5em</div>
<div class="label">border-width: 0.5em</div>
</div>
</div>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
  margin: 24px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: #f5f7fb;
  color: #102a43;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

h1 {
  font-size: 20px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12px;
  color: #486581;
  margin-top: 10px;
  word-break: break-word;
}

.note {
  font-size: 13px;
  color: #486581;
  margin-top: 14px;
}

/*  examples */
.box {
  height: 70px;
  display: grid;
  place-items: center;
  border-style: solid;
  border-color: #2563eb;
  border-radius: 6px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 13px;
}

.thin { border-width: thin; }
.medium { border-width: medium; }
.thick { border-width: thick; }
.len { border-width: 10px; }
.em { border-width: 0.5em; }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS line-width data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.

This data type is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.