CSS Portal

CSS flood-color Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The flood-color CSS property specifies the solid color that is used by a flood painting operation inside a filter chain — most commonly the SVG filter primitive that produces a uniform color region. Rather than painting directly onto the element itself, this color becomes the source image for subsequent filter steps, so it functions as a paint layer that other filter primitives or blend/composite operations can use. In practical terms, it defines the visual "fill" of the flood source that will be composited with other parts of the filter processing pipeline.

When used together with the transparency control provided by flood-opacity, the property enables you to create anything from fully opaque colored backdrops to subtle, translucent tints that affect the look of the filtered content. Because the flood source is just another image in the filter chain, how that color appears in the final rendering depends on the order and types of subsequent filter primitives and compositing steps, and on the overall filter applied to the element via the filter CSS property. Changing the filter chain or the region that the filter covers can dramatically change the visible result of a given flood color.

Design-wise, flood-color is useful whenever you need a uniform color layer inside a complex graphical effect: creating colored backdrops behind blurred content, tinting or recoloring shapes, forming solid masks for compositing, or producing silhouette and glow effects when combined with other primitives. It is scoped to filter contexts (it does not directly repaint an element’s box), so consider filter region size and complexity when using it — large or frequently changing filter regions can increase rendering cost. Also avoid relying solely on colored filter effects to convey essential information, since they can be modified or disabled in some browsing environments and may affect contrast and accessibility.

Definition

Initial value
black
Applies to
<feFlood> and <feDropShadow> elements in <svg>
Inherited
no
Computed value
as specified
Animatable
by computed value
JavaScript syntax
object.style.floodColor

Syntax

flood-color: <color>;

Values

  • <color>Any valid CSS color:
    • Color Keywords: Any standard CSS color name (e.g., blue, darkgreen, transparent).
    • Hexadecimal: 3, 4, 6, or 8-digit hex codes (e.g., #f06).
    • RGB/RGBA: Functional notation for Red, Green, and Blue channels.
    • HSL/HSLA: Functional notation for Hue, Saturation, and Lightness.
    • CurrentColor: Uses the value of the color property from the element.

Example

<div class="wrap">
<h1>CSS flood-color - example</h1>
<div class="row">
<figure>
<img
src="https://images.unsplash.com/photo-1503023345310-bd7c1de61c7d?w=1200&q=80&auto=format&fit=crop"
alt="Landscape"
class="original"
/>
<figcaption>Original</figcaption>
</figure>

<figure>
<img
src="https://images.unsplash.com/photo-1503023345310-bd7c1de61c7d?w=1200&q=80&auto=format&fit=crop"
alt="Landscape"
class="flooded"
/>
<figcaption>With flood-color filter</figcaption>
</figure>
</div>
</div>

<svg aria-hidden="true" focusable="false" style="position:absolute;width:0;height:0;overflow:hidden">
<defs>
<filter id="colorize" x="0" y="0" width="100%" height="100%" color-interpolation-filters="sRGB">
<feFlood result="flood" />
<feComposite in="flood" in2="SourceGraphic" operator="in" />
<feBlend in="SourceGraphic" in2="flood" mode="normal" />
</filter>
</defs>
</svg>
:root {
  --flood-color: #ff3366;
  --flood-opacity: 0.5;
}

/* Basic page layout */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: #f6f7fb;
  margin: 24px;
  color: #111827;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
}

h1 {
  font-size: 18px;
  margin-bottom: 16px;
}

.row {
  display: flex;
  gap: 24px;
  align-items: start;
}

figure {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: #374151;
}

img {
  width: 420px;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(16,24,40,0.08);
  display: block;
}

/* Apply the SVG filter to the second image */
.flooded {
  filter: url(#colorize);
}

/* Set the feFlood color and opacity using the CSS properties */
svg feFlood {
  flood-color: var(--flood-color);
  flood-opacity: var(--flood-opacity);
}

Browser Support

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

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!