HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

mask

Description

The mask property for CSS is shorthand for mask-image, mask-position, mask-size, mask-repeat, mask-origin, mask-clip, mask-composite, and mask-mode.

Syntax

CSS

mask: value;

JS

object.style.mask = "value";

Values

<'mask'> = <mask-layer>#
<mask-layer> = <mask-reference> || <position> [ / <bg-size> ]? ||<repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode>
<mask-reference> = none | <image> | <mask-source>
none

A transparent black image layer.

<image> = <url> | <gradient>
<url> = url( <string> <url-modifier>* )
<string>

Specifies a sequence of characters delimited by double quotes (") or single quotes (').

<url-modifier>

Changes the meaning or the interpretation of the URL.

<gradient> = <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()>
<linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )
<angle>
deg

Degrees. There are 360 degrees in a full circle.

grad

Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle.

rad

Radians. There are 2p radians in a full circle.

turn

Turns. There is 1 turn in a full circle.

<side-or-corner> = [left | right] || [top | bottom]
left

Left.

right

Right.

top

Top.

bottom

Bottom.

<color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]#
<linear-color-stop> = <color> && <length-percentage>?
<color>

Specifies the color using a keyword or a numerical specification.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<linear-color-hint> = <length-percentage>
<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<repeating-linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )
<angle>
deg

Degrees. There are 360 degrees in a full circle.

grad

Gradians, also known as "gons" or "grades". There are 400 gradians in a full circle.

rad

Radians. There are 2p radians in a full circle.

turn

Turns. There is 1 turn in a full circle.

<side-or-corner> = [left | right] || [top | bottom]
left

Left.

right

Right.

top

Top.

bottom

Bottom.

<color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]#
<linear-color-stop> = <color> && <length-percentage>?
<color>

Specifies the color using a keyword or a numerical specification.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<linear-color-hint> = <length-percentage>
<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<radial-gradient()> = radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )
<ending-shape>

Determines whether the gradient's ending shape is a circle or an ellipse.

<size>

Determines the size of the gradient's ending shape.

<position> = [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]
left

Left.

center

Center.

right

Right.

top

Top.

bottom

Bottom.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]#
<linear-color-stop> = <color> && <length-percentage>?
<color>

Specifies the color using a keyword or a numerical specification.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<linear-color-hint> = <length-percentage>
<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<repeating-radial-gradient()> = radial-gradient( [ <ending-shape> || <size> ]? [ at <position> ]? , <color-stop-list> )
<ending-shape>

Determines whether the gradient's ending shape is a circle or an ellipse.

<size>

Determines the size of the gradient's ending shape.

<position> = [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]
left

Left.

center

Center.

right

Right.

top

Top.

bottom

Bottom.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<color-stop-list> = <linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]#
<linear-color-stop> = <color> && <length-percentage>?
<color>

Specifies the color using a keyword or a numerical specification.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<linear-color-hint> = <length-percentage>
<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<mask-source> = <url>
<url> = url( <string> <url-modifier>* )
<string>

Specifies a sequence of characters delimited by double quotes (") or single quotes (').

<url-modifier>

Changes the meaning or the interpretation of the URL.

<position> = [ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]
left

Left.

center

Center.

right

Right.

top

Top.

bottom

Bottom.

<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

<bg-size> = [ <length-percentage [0,∞]> | auto ]{1,2} | cover | contain
<length-percentage> =
    <length> |
    <percentage>
<length>

Specifies the length using a number followed by a unit of measurement.

<percentage>

Specifies the percentage using a number followed by a percent sign (%).

auto

Automatically specified by the user agent.

cover

Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.

contain

Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.

<repeat-style> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2}
repeat-x

The image is repeated in the horizontal direction as often as needed to cover the background painting area.

repeat-y

The image is repeated in the vertical direction as often as needed to cover the background painting area.

repeat

The image is repeated in the horizontal and vertical direction as often as needed to cover the background painting area.

space

The image is repeated as often as will fit within the background positioning area without being clipped and then the images are spaced out to fill the area.

round

The image is repeated as often as will fit within the background positioning area. If it doesn't fit a whole number of times, it is rescaled so that it does.

no-repeat

The image is placed once and not repeated in this direction.

<geometry-box> = <shape-box> | fill-box | stroke-box | view-box
<shape-box> = <box> | margin-box
<box> = border-box | padding-box | content-box
border-box

Area within the border box.

padding-box

Area within the padding box.

content-box

Area within the content box.

margin-box

Area within the margin box.

fill-box

Uses the object bounding box as a reference box.

stroke-box

Uses the stroke bounding box as a reference box.

view-box

Uses the nearest SVG viewport as a reference box.

no-clip

The painted content is not restricted (not clipped).

<compositing-operator> = add | subtract | intersect | exclude
add

The source is placed over the destination.

subtract

The source is placed, where it falls outside of the destination.

intersect

The parts of source that overlap the destination, replace the destination.

exclude

The non-overlapping regions of source and destination are combined.

<masking-mode> = alpha | luminance | match-source
alpha

Indicates the alpha values of the mask layer image should be used as the mask values.

luminance

Indicates the luminance values of the mask layer image should be used as the mask values.

match-source

The value specified by the referenced mask element's mask-type property must be used.

Examples

1 · mask-clip · border-box

2 · mask-clip · content-box

3 · mask-clip · fill-box

4 · mask-clip · margin-box

5 · mask-clip · no-clip

6 · mask-clip · padding-box

7 · mask-clip · stroke-box

8 · mask-clip · view-box

9 · mask-clip · JS

10 · mask-composite · add

11 · mask-composite · exclude

12 · mask-composite · intersect

13 · mask-composite · subtract

14 · mask-composite · JS

15 · mask-image · image · gradient · linear-gradient

16 · mask-image · image · gradient · radial-gradient

17 · mask-image · image · url

18 · mask-image · none

19 · mask-image · JS

20 · mask-mode · alpha

21 · mask-mode · luminance

22 · mask-mode · match-source

23 · mask-mode · JS

24 · mask-origin · border-box

25 · mask-origin · content-box

26 · mask-origin · fill-box

27 · mask-origin · margin-box

28 · mask-origin · padding-box

29 · mask-origin · stroke-box

30 · mask-origin · view-box

31 · mask-origin · JS

32 · mask-position · bottom

33 · mask-position · center

34 · mask-position · left

35 · mask-position · length

36 · mask-position · percentage

37 · mask-position · right

38 · mask-position · top

39 · mask-position · JS

40 · mask-repeat · no-repeat

41 · mask-repeat · repeat

42 · mask-repeat · repeat-x

43 · mask-repeat · repeat-y

44 · mask-repeat · round

45 · mask-repeat · space

46 · mask-repeat · JS

47 · mask-size · auto

48 · mask-size · contain

49 · mask-size · cover

50 · mask-size · length

51 · mask-size · percentage

52 · mask-size · JS