Favorites

CSS d Property

d
CSS PropertyThis property is supported in some modern browsers, but not all.
Updated 22nd November 2026

The d property sets the path data of an SVG path element, the same as its d attribute, so paths can be changed and animated with CSS.

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 d property defines the path data of an SVG <path> element: the sequence of move, line, curve and arc commands that draws its shape. It is the CSS counterpart of the d attribute and takes the same path string wrapped in the path() function, for example d: path("M 10 80 Q 95 10 180 80").

Being a CSS property, the path can be swapped in media queries or on :hover, and it can be animated: when the start and end paths have the same structure (the same number and type of commands), the browser interpolates each coordinate, producing smooth morphing between shapes.

Safari parses the property but does not apply it, so keep the d attribute on the element as a fallback.

Definition

Initial value
none
Applies to
<path> elements in SVG
Inherited
no
Computed value
as specified
Animatable
by computed value type (paths with matching commands)
JavaScript syntax
object.style.d

Interactive Demo

Demo Code
HTML Code
<svg class="demo-svg" viewBox="0 0 200 120" width="260" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H200V120H0Z M50 0V120 M100 0V120 M150 0V120 M0 30H200 M0 60H200 M0 90H200" fill="none" stroke="#dde1ea" stroke-width="1"/>
<path class="demo-element" fill="rgb(247 37 133 / 25%)" stroke="#f72585" stroke-width="4"/>
</svg>
CSS Code
.demo-element {
	d: path("M 20 100 L 100 20 L 180 100 Z");
}

Syntax

d: none | path(<string>);

Values

  • noneThe default. No path is drawn (unless the d attribute is set).
  • path(<string>)A string of SVG path commands such as "M 10 10 L 90 90".
  • initialSets the property to its initial value.
  • inheritTakes the computed value of the parent element.

Example

<svg viewBox="0 0 300 160">
<path class="wave" d="M 20 80 Q 80 20 150 80 T 280 80" fill="none" stroke="#4361ee" stroke-width="6"/>
</svg>
svg {
  width: 300px;
  height: 160px;
  border: 1px solid #ddd;
  background: #fafbff;
}

.wave {
  d: path("M 20 80 Q 80 20 150 80 T 280 80");
  transition: d 0.8s ease;
}

svg:hover .wave {
  d: path("M 20 80 Q 80 140 150 80 T 280 80");   /* morphs on hover */
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS d property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported in some modern browsers, but not all.

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.