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

CSS बैकग्राउंड प्रॉपर्टीज

CSS बैकग्राउंड प्रॉपर्टीज हमें एलिमेंट्स के बैकग्राउंड को स्टाइल करने में मदद करती हैं। CSS background प्रॉपर्टी किसी एलिमेंट के बैकग्राउंड को निर्दिष्ट करने का एक शॉर्टहैंड है। background-color, background-image, background-repeat, background-position, background-clip, background-size, background-origin और background-attachment मिलकर CSS बैकग्राउंड प्रॉपर्टीज बनाते हैं।

सिंटैक्स

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

Selector {    background: /*value*/ }

उदाहरण

निम्नलिखित उदाहरण CSS background प्रॉपर्टी को दर्शाते हैं:

<!DOCTYPE html> <html> <head> <style> #main {    margin: auto;    width: 300px;    background-image: url("https://www.tutorialspoint.com/hadoop/images/hadoop-mini-logo.jpg");    background-repeat: no-repeat;    background-size: cover; } #im {    height: 200px;    width: 200px;    background-image: url("https://www.tutorialspoint.com/images/css.png");    background-repeat: no-repeat;    background-position: center; } </style> </head> <body> <div id="main"> <div id="im"></div> </div> </body> </html>

आउटपुट

यह निम्नलिखित आउटपुट देता है:

CSS बैकग्राउंड प्रॉपर्टीज

दूसरा उदाहरण

<!DOCTYPE html> <html> <head> <style> body {    background-image: url("https://www.tutorialspoint.com/hcatalog/images/hcatalog-mini-logo.jpg"),url("https://www.tutorialspoint.com/hbase/images/hbase-mini-logo.jpg"),url("https://www.tutorialspoint.com/hadoop/images/hadoop-mini-logo.jpg");    background-repeat: no-repeat;    background-attachment: fixed;    background-position: 10% 10%, 40% 40%, 90% 10%; } </style> </head> <body> </body> </html>

आउटपुट

यह निम्नलिखित आउटपुट देता है:

CSS बैकग्राउंड प्रॉपर्टीज

  1. CSS में Background शॉर्टहैंड प्रॉपर्टी CSS में Background शॉर्टहैंड प्रॉपर्टी

    CSS background शॉर्टहैंड प्रॉपर्टी का उपयोग किसी एलिमेंट के लिए बैकग्राउंड को परिभाषित करने के लिए किया जाता है। background-color, background-image, background-repeat, background-position, background-clip, background-size, background-origin और background-attachment मिलकर CSS background प्रॉपर्टीज बन

  1. CSS Margin प्रॉपर्टीज CSS Margin प्रॉपर्टीज

    CSS margin प्रॉपर्टी margin-top, margin-right, margin-bottom, और margin-left के लिए एक शॉर्टहैंड है। यह हमें एलिमेंट्स के चारों ओर स्पेस निर्दिष्ट करने में सक्षम बनाती है। हम व्यक्तिगत साइड्स के लिए मार्जिन भी सेट कर सकते हैं। सिंटैक्स CSS margin प्रॉपर्टी का सिंटैक्स निम्नलिखित है: Selector { &nbs

  1. CSS से बैकग्राउंड रिपीट CSS से बैकग्राउंड रिपीट

    CSS background-repeat प्रॉपर्टी का उपयोग यह परिभाषित करने के लिए किया जाता है कि बैकग्राउंड इमेज खुद को कैसे रिपीट करती है।सिंटैक्सCSS background-repeat प्रॉपर्टी का सिंटैक्स निम्नलिखित है:Selector { background-repeat: /*value*/ }उदाहरणनिम्नलिखित उदाहरण CSS background-repeat प्रॉपर्टी को दर्शाते हैं