CSSクリップパスプロパティ
例
画像を50%の円にクリップします。
img {
clip-path:
circle(50%);
}
定義と使用法
このclip-path
プロパティを使用すると、要素を基本形状またはSVGソースにクリップできます。
注:このclip-path
プロパティは、非推奨のclip
プロパティに置き換わります。
デフォルト値: | なし |
---|---|
遺伝性の: | いいえ |
アニメート可能: | 基本形状の場合ははい。アニメート可能について読む |
バージョン: | CSSマスキングモジュールレベル1 |
JavaScript構文: | object .style.clipPath = "circle(50%)" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
clip-path | 55.0 23.0 -webkit- |
79.0* | 54.0 | 9.1 6.1 -webkit- |
42.0 15.0 -webkit- |
*バージョン79より前では、EdgeはSVG要素(HTML要素ではない)でのみクリップパスをサポートしていました。
CSS構文
clip: clip-source|basic-shape|margin-box|border-box|padding-box|content-box|fill-box|stroke-box|view-box|none|initial|inherit;
プロパティ値
Value | Description | Play it |
---|---|---|
clip-source | Defines a URL to an SVG <clipPath> element | |
basic-shape | Clips an element to a basic shape: circle, ellipse, polygon or inset | |
margin-box | Uses the margin box as the reference box | |
border-box | Uses the border box as the reference box | |
padding-box | Uses the padding box as the reference box | |
content-box | Uses the content box as the reference box | |
fill-box | Uses the object bounding box as reference box | |
stroke-box | Uses the stroke bounding box as reference box | |
view-box | Uses the SVG viewport as reference box | |
none | This is default. No clipping is done | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |