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

CSS से कंटेनिंग टेक्स्ट के साथ कमेंट बॉक्स कैसे बनाएं?

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

सिंटैक्स

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

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

उदाहरण 1

निम्न उदाहरण दिखाते हैं कि हम CSS का उपयोग करके कमेंट बॉक्स कैसे बना सकते हैं।

<!DOCTYPE html> <html>    <head>       <style>          .cb {             position: relative;             padding: 2%;             border-radius: 8%;             width:25%;          }          .cb::after {             content: "";             position: absolute;             height: 30px;             width: 30px;             bottom: -30px;             left: 80%;          }          #one {             box-shadow: inset 0 0 12px green;             left: 65%;          }          #two {             box-shadow: inset 0 0 12px blue;             left: 4%;          }          #one::after {             left: 80%;             box-shadow: inset 0 0 12px green;             clip-path: polygon(0 0, 100% 0, 100% 80%);          }          #two::after{             left: 8%;             box-shadow: inset 0 0 12px blue;             clip-path: polygon(0 0, 100% 0, 0 80%);          }       </style>    </head>    <body>       <div class="cb" id="one">          Demo Comment 1       </div>       <div class="cb" id="two">          Demo Comment 2       </div>    </body> </html>

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

CSS से कंटेनिंग टेक्स्ट के साथ कमेंट बॉक्स कैसे बनाएं?

उदाहरण 2

<!DOCTYPE html> <html>    <head>       <style>          .cb {             position: relative;             padding: 2%;             border-radius: 8%;             width:15%;             box-shadow: inset 0 0 12px orange;          }          .cb::after {             content: "";             position: absolute;             height: 30px;             width: 30px;             bottom: -30px;             left: 80%;             box-shadow: inset 0 0 12px orange;          }          #one {             left: 65%;          }          #one::after {             left: 10%;             clip-path: polygon(0 0, 100% 0, 0 80%);          }          span{             background-color: lightblue;          }       </style>    </head>    <body>       <div class="cb" id="one">          accumsan       </div>       <p>             Aenean tempor lobortis porttitor. Nulla erat purus, commodo <span>accumsan</span> viverra id, sollicitudin eget dui. Curabitur mollis scelerisque quam, vitae dictum diam dictum in. Aenean fermentum efficitur suscipit. Donec non ligula purus.       </p>    </body> </html>

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

CSS से कंटेनिंग टेक्स्ट के साथ कमेंट बॉक्स कैसे बनाएं?

  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, Ge

  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

  1. CSS से कंटेनिंग टेक्स्ट के साथ कमेंट बॉक्स कैसे बनाएं? CSS से कंटेनिंग टेक्स्ट के साथ कमेंट बॉक्स कैसे बनाएं?

    कमेंट बॉक्स clip-path प्रॉपर्टी का उपयोग करके बनाया जा सकता है। सिंटैक्स CSS clip-path प्रॉपर्टी का सिंटैक्स निम्नानुसार है: Selector {    clip-path: /*value*/ } उदाहरण 1 निम्न उदाहरण दिखाते हैं कि हम CSS का उपयोग करके कमेंट बॉक्स कैसे बना सकते हैं। <!DOCTYPE html> <html>