invert()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
invert()
は CSS の関数で、入力画像の色サンプルを反転します。結果は <filter-function>
です。
試してみましょう
filter: invert(0);
filter: invert(0.3);
filter: invert(50%);
filter: invert(70%);
filter: invert(1);
<section id="default-example">
<img
class="transition-all"
id="example-element"
src="/shared-assets/images/examples/firefox-logo.svg"
width="200" />
</section>
構文
css
invert(amount)
引数
amount
-
変換の度合いで、
<number>
または<percentage>
で指定します。100%
の値では完全に反転され、0%
の値では入力が変更されないままになります。0%
と100%
の間の値は、効果の割合です。補間の初期値は0
です。
例
invert() の正しい値の例
css
invert(0) /* 効果なし */
invert(.6) /* 60% 反転 */
invert(100%) /* 完全に反転 */
仕様書
Specification |
---|
Filter Effects Module Level 1 # funcdef-filter-invert |
ブラウザーの互換性
関連情報
その他の filter
および backdrop-filter
プロパティの値で使用できる <filter-function>
関数には、次のものがあります。