Styl fontStyleiendom _
Voorbeeld
Stel die lettertipe vir 'n element op "kursief":
document.getElementById("demo").style.fontStyle = "italic";
Definisie en gebruik
Die fontStyle-eienskap stel of gee terug of die styl van die font normaal, kursief of skuins is.
Blaaierondersteuning
Property | |||||
---|---|---|---|---|---|
fontStyle | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Gee die fontStyle-eienskap terug:
object.style.fontStyle
Stel die fontStyle-eienskap:
object.style.fontStyle = "normal|italic|oblique|initial|inherit"
Eiendomswaardes
Value | Description |
---|---|
normal | Font is normal. This is default |
italic | Font is in italic |
oblique | Font is in oblique |
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 fontstyl van die teks in die element verteenwoordig |
CSS weergawe | CSS1 |
Meer voorbeelde
Voorbeeld
'n Demonstrasie van moontlike waardes:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontStyle = listValue;
Voorbeeld
Gee die fontstyl van 'n element terug:
alert(document.getElementById("demo").style.fontStyle);
Verwante bladsye
CSS-tutoriaal: CSS Font
CSS verwysing: font-styl eiendom
HTML DOM verwysing: font eiendom
❮ Stylvoorwerp