Style fontStyle-eigenschap
- Previous Page fontSize
- Next Page fontVariant
- Go to the Previous Level HTML DOM Style Object
Definitie en gebruik
fontStyle
De eigenschap instellen of retourneren van de letterstijl is normaal, schuin of hellend.
Zie ook:
CSS Tutorial:CSS Font
CSS Referentiemanual:font-style-eigenschap
HTML DOM Referentiemanual:Letter-eigenschap
Voorbeeld
Voorbeeld 1
Stel de letterstijl van het <p>-element in op "italic" (schuin):
document.getElementById("myP").style.fontStyle = "italic";
Voorbeeld 2
Demonstratie van mogelijke waarden:
var listValue = selectTag.options[selectTag.selectedIndex].text; document.getElementById("myP").style.fontStyle = listValue;
Voorbeeld 3
Retourneer de letterstijl van het <p>-element:
alert(document.getElementById("myP").style.fontStyle);
Syntax
Retour fontStyle-eigenschap:
object.style.fontStyle
Stel fontStyle-eigenschap in:
object.style.fontStyle = "normal|italic|oblique|initial|inherit"
Eigenschapswaarde
Waarde | Beschrijving |
---|---|
normal | Lettertype normaal. Standaard. |
italic | Lettertype schuin. |
oblique | Letterhelling. |
initial | Stel deze eigenschap in op zijn standaardwaarde. Raadpleeg initial. |
inherit | Inherit deze eigenschap van de ouder element. Raadpleeg inherit. |
Technische details
Standaardwaarde: | normal |
---|---|
Retourwaarde: | String, die de letterstijl van de tekst in het element aangeeft. |
CSS Versie: | CSS1 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page fontSize
- Next Page fontVariant
- Go to the Previous Level HTML DOM Style Object