Styl fontWeight Property
Voorbeeld
Stel die lettertipe gewig vir 'n element na "900":
document.getElementById("demo").style.fontWeight = "900";
Definisie en gebruik
Die fontWeight-eienskap stel of gee terug hoe dik of dun karakters in 'n teks vertoon moet word.
Blaaierondersteuning
Property | |||||
---|---|---|---|---|---|
fontWeight | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Gee die fontWeight-eienskap terug:
object.style.fontWeight
Stel die fontWeight-eienskap:
object.style.fontWeight = "normal|lighter|bold|bolder|value|initial|inherit"
Eiendomswaardes
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 |
Tegniese besonderhede
Standaard waarde: | normaal |
---|---|
Terugkeerwaarde: | 'n String wat die vrymoedigheid van die lettertipe voorstel |
CSS weergawe | CSS1 |
Meer voorbeelde
Voorbeeld
'n Demonstrasie van moontlike waardes:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontWeight = listValue;
Voorbeeld
Gee die lettertipe gewig van 'n element terug:
alert(document.getElementById("demo").style.fontWeight);
Verwante bladsye
CSS-tutoriaal: CSS Font
CSS verwysing: font-weight eiendom
HTML DOM verwysing: font eiendom
❮ Stylvoorwerp