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
<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
BCD tables only load in the browser
Siehe auch
- CSS-Eigenschaft
fill-opacity
opacity
stop-opacity
stroke-opacity