fill-opacity

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2020.

Das Attribut fill-opacity ist ein Präsentationsattribut, das die Deckkraft des Farbanschlusses (color, gradient, pattern etc.) definiert, der auf eine Form angewendet wird.

Hinweis: Als Präsentationsattribut hat fill-opacity auch ein entsprechendes CSS-Eigenschaftsgegenstück: fill-opacity. Wenn beide angegeben sind, hat die CSS-Eigenschaft Vorrang.

Sie können dieses Attribut mit den folgenden SVG-Elementen verwenden:

Beispiel

html
<svg viewBox="0 0 400 100" xmlns="http://www.w3.org/2000/svg">
  <!-- Default fill opacity: 1 -->
  <circle cx="50" cy="50" r="40" />

  <!-- Fill opacity as a number -->
  <circle cx="150" cy="50" r="40" fill-opacity="0.7" />

  <!-- Fill opacity as a percentage -->
  <circle cx="250" cy="50" r="40" fill-opacity="50%" />

  <!-- Fill opacity as a CSS property -->
  <circle cx="350" cy="50" r="40" style="fill-opacity: .25;" />
</svg>

Hinweise zur Verwendung

Wert [0-1] | <percentage>
Standardwert 1
Animierbar Ja

Hinweis: SVG2 führt Prozentwerte für fill-opacity ein, jedoch wird dies noch nicht weitreichend unterstützt (Siehe Browser-Kompatibilität unten). Daher ist es eine bewährte Praxis, die Deckkraft mit einem Wert im Bereich [0-1] festzulegen.

Spezifikationen

Specification
Scalable Vector Graphics (SVG) 2
# FillOpacity

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
fill-opacity

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch