W3cubDocs

/SVG

stroke-opacity

the stroke-opacity attribute specifies the opacity of the outline on the current object. Its default value is 1.

As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet

Usage context

Categories Presentation attribute
Value <opacity-value> | inherit
Animatable Yes
Normative document SVG 1.1 (2nd Edition)
<opacity-value>
The opacity of the painting operation used to outline the current object, as a number. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range.

Example

SVG

<svg width="120px" height="120px" viewBox="0 0 120 120">
  <rect x="10" y="10" width="100" height="100"/>
</svg>

CSS

rect{
  fill:#b4da55;
  stroke:#000;
  stroke-width:10px;
  stroke-opacity:0.3;
}

Result

Elements

The following elements can use the stroke-opacity attribute

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-opacity