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

CSS padding-box वैल्यू


CSS background-origin प्रॉपर्टी का उपयोग करके padding-box वैल्यू सेट करें। padding-box वैल्यू के साथ, बैकग्राउंड इमेज पैडिंग एज के ऊपरी बाएं कोने से शुरू होती है।

padding-box वैल्यू लागू करने के लिए निम्न कोड चलाकर देखें:

उदाहरण

<!DOCTYPE html> <html>    <head>       <style>          #value1 {             border: 3px solid blue;             padding: 30px;             background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg);             background-repeat: no-repeat;             background-origin: padding-box;          }          #value2 {             border: 3px solid orange;             padding: 30px;             background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg);             background-repeat: no-repeat;             background-origin: border-box;          }          #value3 {             border: 3px dashed yellow;             padding: 30px;             background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg);             background-repeat: no-repeat;             background-origin: content-box;          }       </style>    </head>    <body>       <h1>padding-box value</h1>       <div id = "value1">          <h2>Heading 2</h2>          <p>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>          <h3>Heading 3</h3>          This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>       </div>       <h1>border-box value</h1>       <div id = "value2">          <h2>Heading 2</h2>          <p>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.          <h3>Heading 3</h3>             This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>       </div>       <h1>content-box value</h1>       <div id = "value3">          <h2>Heading 2</h2>          <p>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.          <h3>Heading 3</h3>             This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>       </div>    </body> </html>

  1. CSS linear-gradient() फंक्शन CSS linear-gradient() फंक्शन

    linear-gradient() फंक्शन linear-gradient() का उपयोग रैखिक ग्रेडिएंट को बैकग्राउंड इमेज के रूप में परिभाषित करने के लिए किया जाता है। सिंटैक्स: background-image: linear-gradient(direction, color-stop1, color-stop2, ...); पैरामीटर्स: direction: ग्रेडिएंट की दिशा (to right, to bottom right, 45deg

  1. CSS right प्रॉपर्टी CSS right प्रॉपर्टी

    right प्रॉपर्टी right प्रॉपर्टी का उपयोग एलिमेंट की क्षैतिज स्थिति सेट करने के लिए किया जाता है। यह पोजिशन्ड एलिमेंट्स (relative, absolute, fixed, sticky) पर काम करता है। सिंटैक्स: right: auto | length | % | initial | inherit; मान: auto: ब्राउज़र गणना करता है (डिफ़ॉल्ट) length: px, em, rem,

  1. CSS से टेक्स्ट इंडेंटेशन CSS से टेक्स्ट इंडेंटेशन

    text-indent प्रॉपर्टी टेक्स्ट इंडेंटेशन के लिए CSS में text-indent प्रॉपर्टी का उपयोग करें। यह पैराग्राफ की पहली लाइन की इंडेंटेशन के लिए है। उदाहरण 1: 30px इंडेंट <!DOCTYPE html> <html> <head> <style> div { text-indent: 30px; } </style> </head> <body> <