Awesome CSS Tricks


1
flip-img
Ladybug
Ladybug
2
flip-img
3
#556b2f rgb(85,107,47)
#2f556b rgb(47,85,107)
#6b2f55 rgb(107,47,85)
#55647B rgb(85,100,123)
Font size = "1"
Font size = "2"
Font size = "3"
Font size = "4"
Font size = "5"
Font size = "6"
Font size = "7"

4
css-tricks
5
clip-circle
6
css-tricks
7
clip-polygon

8 css-tricks1

works on my other pages.

9 css-tricks2

10 css-tricks3

SVG Mask Applied:

Here is the sample.png

mask image
11

Here is the mask.png

mask image

12

mega
fancy

13 crop
Donald Duck

14 Shapes svg-clipped1 Cherry Blossoms.
15 svg-clipped2 Cherry Blossoms.
16 svg-clipped3 Cherry Blossoms. Blossom

17 svg-clipped4 Cherry Blossoms.
18 svg-clipped5 Cherry Blossoms.
19 svg-clipped6 Cherry Blossoms.

20 clip-mask Original shape with stroke styles Rectangle with shape clip-path Rectangle with shape mask

21

CSS and SVG Masks

Text
22
23
24
25

26
27
28
29
Text

30
Text
31

Trade Winds

Lobster

Pacifico

Parisienne

Tangerine

32 .lomo-4

33
34

CSS & SVG Masks Test cases on HTML/SVG content All code blocks are real-time editable. Prefixes are required for some test cases, but are automatically added by Autoprefixer for convenience. In the page: Clipping Masking Notes Clipping Clipping in CSS can be compared to Photoshop “Vector Masks”. So only vector shapes.

35 clip: rect()C1
Note: Property deprecated
36 clip-path: inset()C2
37 clip-path: circle()C3
38 clip-path: polygon()C4
39 clip-path: url()C5 Referencing inline SVG

40 CSS clip-path on SVG contentC8
41 SVG on SVG contentC9
Note: The SVG part is not editable due to an Edge bug.

42 Masking Masking in CSS can be compared to Photoshop masks, as follow: Alpha masks are Photoshop “Clipping Masks”: transparency matters. This is the default for CSS masks. Luminance masks are Photoshop “Layer Masks”: white and black matter. This is the default for SVG masks. Here are masks images used on some test cases below: alpha-mask.png and luminance-mask.png

43 mask-image: linear-gradient()M1 Using (default) alpha mask
44

45
46
47 svg-mask

This is a SVG Mask on a SVG Element. Currently works in Webkit, Firefox, IE

48 css-tricks3


49

<mask>

Pattern Mask w/Shapes & SMIL
50
Mask Mode / Mask Image : Bundled Styles
51
SVG Mask
Text Mask
52
Image w/SVG Shape Mask
53
SVG Shape w/Image Mask

54

<clipPath>

Clip Clip
SVG Image w/Text Clip & Stroke
55
SVG Image w/Shape Clip & SMIL
56
My Clip Path a clipped path using a circle as the clipping shape
Shape Clip & SMIL
57
SVG Shape Clip & Image

58 Twenty-five Percent
59 Seventy-five Percent

60 flower
61 animals
62
63 butterfly

64


mask-box-image

65


alpha-mask.png


alpha-cat.png


heartmask.png


mask-image.png


splatter-mask.png


trapeze.png

66


luminance-cat.png


heartmask.png


masque2.png


tile.png

67

68
69
70

71
72

This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart- shaped mask.This div element has a heart-shaped mask.

This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart-shaped mask.This div element has a heart- shaped mask.This div element has a heart-shaped mask.

73

74
1
75
2
76

77
78

gradient Text Style


79

Sometimes a web page's text content appears to be funneling your attention towards a spot on the page to drive you to follow a particular link. Sometimes you don't notice.

80
81
82