शैली फ़ॉन्टवेट संपत्ति
उदाहरण
किसी तत्व के लिए फ़ॉन्ट वजन "900" पर सेट करें:
document.getElementById("demo").style.fontWeight = "900";
परिभाषा और उपयोग
FontWeight प्रॉपर्टी सेट या रिटर्न करती है कि टेक्स्ट में कितने मोटे या पतले अक्षर प्रदर्शित होने चाहिए।
ब्राउज़र समर्थन
Property | |||||
---|---|---|---|---|---|
fontWeight | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
फॉन्टवेट संपत्ति लौटाएं:
object.style.fontWeight
फ़ॉन्टवेट संपत्ति सेट करें:
object.style.fontWeight = "normal|lighter|bold|bolder|value|initial|inherit"
सम्पत्ति की कीमत
Value | Description |
---|---|
normal | Font is normal. This is default |
lighter | Font is lighter |
bold | Font is bold |
bolder | Font is bolder |
100 200 300 400 500 600 700 800 900 |
Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
टेक्निकल डिटेल
डिफ़ॉल्ट मान: | साधारण |
---|---|
प्रतिलाभ की मात्रा: | एक स्ट्रिंग, फ़ॉन्ट की बोल्डनेस का प्रतिनिधित्व करता है |
सीएसएस संस्करण | सीएसएस 1 |
और ज्यादा उदाहरण
उदाहरण
संभावित मूल्यों का प्रदर्शन:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontWeight = listValue;
उदाहरण
किसी तत्व का फ़ॉन्ट वजन लौटाएं:
alert(document.getElementById("demo").style.fontWeight);
संबंधित पृष्ठ
सीएसएस ट्यूटोरियल: सीएसएस फ़ॉन्ट
सीएसएस संदर्भ: फ़ॉन्ट-भार गुण
HTML DOM संदर्भ: फ़ॉन्ट गुण
❮ स्टाइल ऑब्जेक्ट