CSSマスク位置プロパティ
例
マスクレイヤー画像の位置を中央に設定します。
.mask1 {
-webkit-mask-image: url(w3logo.png);
mask-image: url(w3logo.png);
-webkit-mask-size: 50%;
mask-size: 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: center;
mask-position: center;
}
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
このmask-position
プロパティは、マスク画像の開始位置を(マスク位置領域に対して)設定します。
ヒント:デフォルトでは、マスク画像は要素の左上隅に配置され、垂直方向と水平方向の両方で繰り返されます。
デフォルト値: | 0%0% |
---|---|
遺伝性の: | いいえ |
アニメート可能: | 番号。アニメート可能について読む |
バージョン: | CSS3 |
JavaScript構文: | object .style.maskPosition = "100px center" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
数字の後に-webkit-が続く場合は、プレフィックスを使用して機能した最初のバージョンを指定します。
Property | |||||
---|---|---|---|---|---|
mask-position | 4.0 -webkit- | 79.0 -webkit- | 53.0 | 4.0 -webkit- | 15.0 -webkit- |
CSS構文
mask-position: value;
プロパティ値
Value | Description |
---|---|
left top left center left bottom right top right center right bottom center top center center center bottom |
If you only specify one keyword, the other value will be "center" |
x% y% | The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%. Default value is: 0% 0% |
xpos ypos | The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
その他の例
例
マスクレイヤー画像の位置を右下隅に設定します。
.mask1 {
-webkit-mask-image: url(w3logo.png);
mask-image: url(w3logo.png);
-webkit-mask-size: 50%;
mask-size: 50%;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: 100% 100%;
mask-position: 100% 100%;
}
関連ページ
CSSリファレンス:mask-imageプロパティ
CSSリファレンス:mask-modeプロパティ
CSSリファレンス:mask-originプロパティ
CSSリファレンス:mask-repeatプロパティ
CSSリファレンス:mask-sizeプロパティ
CSSチュートリアル:CSSマスキング