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

CSS में min-height प्रॉपर्टी


हम CSS min-height प्रॉपर्टी का उपयोग करके किसी एलिमेंट के कंटेंट बॉक्स के लिए एक फिक्स्ड मिनिमम हाइट परिभाषित कर सकते हैं, जो एलिमेंट के कंटेंट बॉक्स को छोटा नहीं होने देता, भले ही हाइट min-height से कम हो।

सिंटैक्स

CSS min-height प्रॉपर्टी का सिंटैक्स निम्नलिखित है:

Selector { min-height: /*value*/ }

उदाहरण

आइए CSS min-height प्रॉपर्टी के लिए एक उदाहरण देखते हैं:

<!DOCTYPE html> <html> <head> <title>CSS min-height Property</title> </head> <style> * { padding: 2px; margin:5px; } button { border-radius: 10px; } #containerDiv { width:70%; margin: 0 auto; padding:20px; background-image: linear-gradient(135deg, #dc3545 0%, #9599E2 100%); text-align: center; border-radius: 10px; } #contentDiv{ min-height:150px; } </style> <body> <div id="containerDiv"> <div id="contentDiv"> This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. </div> <button onclick="add()" class="btn">Set minHeight</button> </div> <script> function add() { document.querySelector('#contentDiv').style.minHeight = "100px"; } </script> </body> </html>

आउटपुट

उपरोक्त कोड के लिए आउटपुट निम्नलिखित है:

'Set minHeight' बटन पर क्लिक करने से पहले -

CSS में min-height प्रॉपर्टी

'Set minHeight' बटन पर क्लिक करने के बाद -

CSS में min-height प्रॉपर्टी

उदाहरण

आइए CSS min-height प्रॉपर्टी का एक और उदाहरण देखते हैं:

<!DOCTYPE html> <html> <head> <title>CSS min-height Property</title> </head> <style> * { padding: 2px; margin:5px; } button { border-radius: 10px; } #containerDiv { width:70%; margin: 0 auto; padding:20px; background-image: linear-gradient(135deg, #dc3545 0%, #9599E2 100%); text-align: center; border-radius: 10px; } #contentDiv1, #contentDiv2{ width:50%; border: 2px solid black; margin: 0 auto; } </style> <body> <div id="containerDiv"> <div id="contentDiv1"> This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. </div> <div id="contentDiv2"> This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy text. This is paragraph 1 with some dummy. </div> <button onclick="add()" class="btn">Set minHeight</button> </div> <script> function add() { document.querySelector('#contentDiv1').style.minHeight = "95px"; } </script> </body> </html>

आउटपुट

उपरोक्त कोड के लिए आउटपुट निम्नलिखित है:

'Set minHeight' बटन पर क्लिक करने से पहले -

CSS में min-height प्रॉपर्टी

'Set minHeight' बटन पर क्लिक करने के बाद -

CSS में min-height प्रॉपर्टी

  1. CSS में outline-width प्रॉपर्टी CSS में outline-width प्रॉपर्टी

    outline-width प्रॉपर्टी को एलिमेंट के बॉर्डर्स के चारों ओर एक विशिष्ट मोटाई की लाइन खींचने के लिए परिभाषित किया जा सकता है, लेकिन आउटलाइन बॉर्डर प्रॉपर्टी के विपरीत एलिमेंट के डायमेंशन्स का हिस्सा नहीं होती।सिंटैक्सCSS outline-width प्रॉपर्टी का सिंटैक्स निम्नलिखित है:Selector { outline-width: /*val

  1. CSS में border-color प्रॉपर्टी CSS में border-color प्रॉपर्टी

    CSS border-color प्रॉपर्टी का उपयोग एलिमेंट्स के लिए बॉर्डर कलर स्पेसिफाई करने के लिए किया जाता है। हम border-top-color, border-right-color, border-left-color और border-right-color प्रॉपर्टीज़ का उपयोग करके इंडिविजुअल साइड्स के लिए कलर भी सेट कर सकते हैं।सिंटैक्सCSS border-color प्रॉपर्टी का सिंटैक्

  1. CSS में border-style प्रॉपर्टी CSS में border-style प्रॉपर्टी

    CSS border-style प्रॉपर्टी का उपयोग किसी एलिमेंट के लिए बॉर्डर स्टाइल स्पेसिफाई करने के लिए किया जाता है। हम border-top-style, border-right-style, border-left-style और border-right-style प्रॉपर्टीज़ का उपयोग करके इंडिविजुअल साइड्स के लिए बॉर्डर-स्टाइल भी परिभाषित कर सकते हैं।सिंटैक्सCSS border प्रॉप