CSS polygon() Function
The polygon() function is an inbuilt function in CSS that is used with the filter property to create a polygon of images or text.
Syntax:
polygon( percentage | length);
Parameter: This function accepts two parameter percentage or length which is used to hold the value of polygon size.
Return value: It makes the polygon shape image or text as the wants user wants.
Example:
html
<!DOCTYPE html> < html > < head > < title > CSS polygon() function </ title > < style > div { float: left; width: 250px; height: 160px; shape-outside: polygon(0 0, 100% 50%, 0 100%); } img { -webkit-clip-path: polygon(0 0, 100% 50%, 0 100%); clip-path: polygon(0 0, 100% 50%, 0 100%); } h1, h4 { text-align: center; } h1 { color: green; } </ style > </ head > < body > < h1 >w3wiki</ h1 > < h4 >CSS polygon() function</ h4 > < div > < img src = "https://media.w3wiki.net/wp-content/uploads/20190808143838/logsm.png" alt = "Longtail boat in Thailand" > </ div > < p > How many times were you frustrated while looking out for a good collection of programming/algorithm/interview questions? What did you expect and what did you get? This portal has been created to provide well written, well thought and well explained solutions for selected questions. An IIT Roorkee alumnus and founder of w3wiki. He loves to solve programming problems in most efficient ways. Apart from w3wiki, he has worked with DE Shaw and Co. as a software developer and JIIT Noida as an assistant professor. It is a good platform to learn programming. It is an educational website. Prepare for the Recruitment drive of product based companies like Microsoft, Amazon, Adobe etc with a free online placement preparation course. </ p > </ body > </ html > |
Output:
Supported browser: The browser supported by CSS | polygon() Function are listed below:
- Google Chrome 37 and above
- Microsoft Edge 79 and above
- Internet Explorer not supported
- Mozilla Firefox 54 and above
- Safari 10.1 and above
- Opera 24 and above
Contact Us