Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS clip-path से ट्रायंगल कैसे बनाएं?

हम CSS clip-path प्रॉपर्टी का उपयोग करके एक ट्रायंगल बना सकते हैं।

सिंटैक्स

CSS clip-path प्रॉपर्टी का सिंटैक्स निम्नानुसार है:

Selector {    clip-path: /*value*/ }

उदाहरण 1

निम्न उदाहरण CSS clip-path प्रॉपर्टी को दर्शाते हैं।

<!DOCTYPE html> <html>    <head>       <style>          div {             padding: 10%;             border-radius: 2%;             width: 10%;             box-shadow: inset 0 0 80px violet;             clip-path: polygon(50% 0, 100% 100%, 0% 100%);          }       </style>    </head>    <body>       <div></div>    </body> </html>

इससे निम्न आउटपुट मिलता है:

CSS clip-path से ट्रायंगल कैसे बनाएं?

उदाहरण 2 (बॉर्डर ट्रिक)

<!DOCTYPE html> <html>    <head>       <style>          div {             display: flex;             margin: 10px 0 20px;          }          div > div {             height: 12px;             border-top: 40px ridge orange;             border-right: 20px solid white;             border-bottom: 60px ridge cornflowerblue;             border-left: 80px solid white;          }       </style>    </head>    <body>       <div>          <div></div>       </div>    </body> </html>

इससे निम्न आउटपुट मिलता है:

CSS clip-path से ट्रायंगल कैसे बनाएं?

  1. CSS से नोट्स कैसे बनाएं? CSS से नोट्स कैसे बनाएं?

    CSS से नोट्स बनाने के लिए, कोड निम्नानुसार है -<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style>    body{       font-family: 'Segoe UI', Tahoma, Geneva, Verdana

  1. CSS से 4-कॉलम लेआउट ग्रिड कैसे बनाएं? CSS से 4-कॉलम लेआउट ग्रिड कैसे बनाएं?

    उदाहरण CSS से 4-कॉलम लेआउट ग्रिड बनाने के लिए, निम्न कोड का उपयोग करें: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style>    body {       font-family: "Segoe UI&

  1. CSS से चेकमार्क/टिक कैसे बनाएं? CSS से चेकमार्क/टिक कैसे बनाएं?

    हम CSS का उपयोग करके एक कस्टमाइज़्ड चेकमार्क बना सकते हैं। निम्न उदाहरण इस प्रभाव को दर्शाते हैं: उदाहरण 1 (प्सूडो-एलिमेंट से) <!DOCTYPE html> <html> <style> div {    margin: 2%;    position: relative;    width: 40px;    height: 40px;