CSS polygon() function
- Προηγούμενη σελίδα Λειτουργία perspective() CSS
- Επόμενη σελίδα Λειτουργία pow() CSS
- Επιστροφή στο προηγούμενο επίπεδο Εγχειρίδιο Αναφορών Λειτουργιών CSS
Definition and usage
CSS polygon()
Functions are used to define a polygon.
polygon()
Functions and clip-path
Properties and shape-outside
Properties used together.
Example
Example 1
Clip the image to a polygon:
img { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
Example 2
Clip the image to a polygon:
img { clip-path: polygon(100% 0%, 50% 50%, 100% 100%); }
Example 3
Usage polygon()
,clip-path
and shape-outside
:
img { float: left; clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); shape-outside: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
CSS syntax
polygon(fill-rule, length-percentage)
Value | Description |
---|---|
fill-rule |
Optional. Specifies the fill rule. It can be nonzero or evenodd. The default value is nonzero. |
length-percentage |
Required. Specifies the points that define the polygon. This can be a length or a percentage value. Each point is a pair of x and y coordinates. 0 0 defines the top left corner, 100% 100% defines the bottom right corner. |
Technical details
Version: | CSS Shape Module Level 1 |
---|
Browser support
The numbers in the table represent the first browser version that fully supports this function.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
37 | 79 | 54 | 10.1 | 24 |
related pages
Αναφορά:clip-path attribute
Αναφορά:shape-outside attribute
Αναφορά:Λειτουργία circle()
Αναφορά:Λειτουργία ellipse()
Αναφορά:Λειτουργία inset()
- Προηγούμενη σελίδα Λειτουργία perspective() CSS
- Επόμενη σελίδα Λειτουργία pow() CSS
- Επιστροφή στο προηγούμενο επίπεδο Εγχειρίδιο Αναφορών Λειτουργιών CSS