सीएसएस प्रदर्शन संपत्ति
उदाहरण
कुछ अलग प्रदर्शन मूल्यों का उपयोग:
p.ex1 {display: none;}
p.ex2 {display: inline;}
p.ex3 {display:
block;}
p.ex4 {display: inline-block;}
नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।
परिभाषा और उपयोग
display
गुण किसी तत्व के प्रदर्शन व्यवहार (रेंडरिंग बॉक्स का प्रकार) को निर्दिष्ट करता है ।
HTML में, डिफ़ॉल्ट प्रदर्शन गुण मान HTML विनिर्देशों से या ब्राउज़र/उपयोगकर्ता डिफ़ॉल्ट स्टाइल शीट से लिया जाता है। एक्सएमएल में डिफ़ॉल्ट मान इनलाइन है, जिसमें एसवीजी तत्व शामिल हैं।
डिफ़ॉल्ट मान: | ? |
---|---|
विरासत में मिला: | नहीं |
एनिमेटेबल: | नहीं। एनिमेटेबल के बारे में पढ़ें |
संस्करण: | सीएसएस 1 |
जावास्क्रिप्ट सिंटैक्स: | ऑब्जेक्ट .style.display="none" |
ब्राउज़र समर्थन
तालिका में संख्याएं पहले ब्राउज़र संस्करण को निर्दिष्ट करती हैं जो पूरी तरह से संपत्ति का समर्थन करता है।
Property | |||||
---|---|---|---|---|---|
display | 4.0 | 8.0 | 3.0 | 3.1 | 7.0 |
नोट: "फ्लेक्स" और "इनलाइन-फ्लेक्स" मानों को सफारी में काम करने के लिए -webkit- उपसर्ग की आवश्यकता होती है।
नोट: "प्रदर्शन: सामग्री" एज पूर्व संस्करण 79 में काम नहीं करता है।
सीएसएस सिंटेक्स
display: value;
सम्पत्ति की कीमत
Value | Description | Play it |
---|---|---|
inline | Displays an element as an inline element (like <span>). Any height and width properties will have no effect | |
block | Displays an element as a block element (like <p>). It starts on a new line, and takes up the whole width | |
contents | Makes the container disappear, making the child elements children of the element the next level up in the DOM | |
flex | Displays an element as a block-level flex container | |
grid | Displays an element as a block-level grid container | |
inline-block | Displays an element as an inline-level block container. The element itself is formatted as an inline element, but you can apply height and width values | |
inline-flex | Displays an element as an inline-level flex container | |
inline-grid | Displays an element as an inline-level grid container | |
inline-table | The element is displayed as an inline-level table | |
list-item | Let the element behave like a <li> element | |
run-in | Displays an element as either block or inline, depending on context | |
table | Let the element behave like a <table> element | |
table-caption | Let the element behave like a <caption> element | |
table-column-group | Let the element behave like a <colgroup> element | |
table-header-group | Let the element behave like a <thead> element | |
table-footer-group | Let the element behave like a <tfoot> element | |
table-row-group | Let the element behave like a <tbody> element | |
table-cell | Let the element behave like a <td> element | |
table-column | Let the element behave like a <col> element | |
table-row | Let the element behave like a <tr> element | |
none | The element is completely removed | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
और ज्यादा उदाहरण
उदाहरण
सामग्री संपत्ति मूल्य का उपयोग कैसे करें इसका एक प्रदर्शन। निम्नलिखित उदाहरण में .a कंटेनर गायब हो जाएगा, और चाइल्ड एलिमेंट (.b) एलिमेंट के बच्चों को DOM में अगला लेवल अप करेगा:
.a {
display: contents;
border:
2px solid red;
background-color: #ccc;
padding: 10px;
width: 200px;
}
.b {
border: 2px solid blue;
background-color: lightblue;
padding: 10px;
}
उदाहरण
विरासत में मिली संपत्ति के मूल्य का उपयोग कैसे करें, इसका एक प्रदर्शन:
body {
display: inline;
}
p {
display: inherit;
}
उदाहरण
<div> तत्व के अंदर कुछ लचीली वस्तुओं की दिशा उल्टे क्रम में सेट करें:
div {
display: flex;
flex-direction: row-reverse;
}
संबंधित पृष्ठ
सीएसएस ट्यूटोरियल: सीएसएस प्रदर्शन और दृश्यता
एचटीएमएल डोम संदर्भ: संपत्ति प्रदर्शित करें