स्टाइल बॉक्ससाइज़िंग प्रॉपर्टी
उदाहरण
बॉक्स आकार बदलने की संपत्ति बदलें:
document.getElementById("myDIV").style.boxSizing = "border-box";
परिभाषा और उपयोग
BoxSizing प्रॉपर्टी आपको कुछ तत्वों को एक निश्चित तरीके से एक क्षेत्र में फिट करने के लिए परिभाषित करने की अनुमति देती है।
उदाहरण के लिए, यदि आप दो बॉर्डर वाले बॉक्स साथ-साथ चाहते हैं, तो इसे बॉक्स साइज़िंग को "बॉर्डर-बॉक्स" पर सेट करके प्राप्त किया जा सकता है। यह ब्राउज़र को निर्दिष्ट चौड़ाई और ऊंचाई के साथ बॉक्स को रेंडर करने के लिए बाध्य करता है, और बॉक्स के अंदर बॉर्डर और पैडिंग रखता है।
ब्राउज़र समर्थन
Property | |||||
---|---|---|---|---|---|
boxSizing | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
बॉक्स आकार देने वाली संपत्ति लौटाएं:
object.style.boxSizing
बॉक्स आकार देने वाली संपत्ति सेट करें:
object.style.boxSizing = "content-box|border-box|initial|inherit"
सम्पत्ति की कीमत
Value | Description |
---|---|
content-box | Default value. This is the behavior of width and height as specified by CSS2.1. The specified width and height (and min/max properties) apply to the width and height respectively of the content box of the element. The padding and border of the element are laid out and drawn outside the specified width and height |
border-box | The specified width and height (and min/max properties) on this element determine the border box of the element. That is, any padding or border specified on the element is laid out and drawn inside this specified width and height. The content width and height are calculated by subtracting the border and padding widths of the respective sides from the specified 'width' and 'height' properties |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
टेक्निकल डिटेल
डिफ़ॉल्ट मान: | सामग्री बॉक्स |
---|---|
प्रतिलाभ की मात्रा: | एक स्ट्रिंग, एक तत्व की बॉक्स-आकार की संपत्ति का प्रतिनिधित्व करती है |
सीएसएस संस्करण | CSS3 |
संबंधित पृष्ठ
CSS संदर्भ: बॉक्स-आकार देने वाली संपत्ति
❮ स्टाइल ऑब्जेक्ट