Nos bénévoles n'ont pas encore traduit cet article en Français. Inscrivez-vous et aidez-nous à réaliser cette tâche !
Vous pouvez également lire cet article en English (US).

The opacity attribute specifies the transparency of an object or of a group of objects, that is, the degree to which the background behind the element is overlaid.

Note: As a presentation attribute, opacity can be used as a CSS property. See the css opacity property for more information.

As a presentation attribute, it can be applied to any element but it has effect only on the following eight elements: <a>, <audio>, <canvas>, <circle>, <ellipse>, <foreignObject>, <g>, <iframe>, <image>, <line>, <marker>, <path>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textPath>, <tspan>, <use>, <unknown>, and <video>

<svg viewBox="0 0 200 100" xmlns="">
    <linearGradient id="gradient" x1="0%" y1="0%" x2="0" y2="100%">
      <stop offset="0%" style="stop-color:skyblue;" />
      <stop offset="100%" style="stop-color:seagreen;" />
  <rect x="0" y="0" width="100%" height="100%" fill="url(#gradient)" />
  <circle cx="50" cy="50" r="40" fill="black" />
  <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" />

Usage notes

Default value 1
Value <alpha-value>
Animatable Yes
The uniform opacity setting to be applied across an entire object, as a <number>. Any values outside the range 0.0 (fully transparent) to 1.0 (fully opaque) will be clamped to this range.


Specification Status Comment
CSS Color Module Level 4
The definition of 'opacity' in that specification.
Working Draft Defines in more detail what this attribute applies to.
CSS Color Module Level 3
The definition of 'opacity' in that specification.
Recommendation Defines in more detail what this attribute applies to.
Scalable Vector Graphics (SVG) 2
The definition of 'opacity' in that specification.
Candidate Recommendation References the specification in CSS Color 3 and notes that there are some related attributes.
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'opacity' in that specification.
Recommendation Initial definition

Browser compatibility


Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
opacityChrome ? Edge ? Firefox ? IE ? Opera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?


Compatibility unknown  
Compatibility unknown

See also

Étiquettes et contributeurs liés au document

Étiquettes : 
Contributeurs à cette page : Sebastianz, mdnwebdocs-bot, connorshea, jalbertbowden, Jeremie
Dernière mise à jour par : Sebastianz,