propriété HTML DOM style fontWeight
Définition et utilisation
fontWeight ensembles de propriétés ou retourne le poids de la police.
grammaire
Définition des propriétés fontWeight:
Object.style.fontWeight="value"
Retour propriétés fontWeight:
Object.style.fontWeight
值 | 描述 |
---|---|
normal | 默认。字体是 normal(正常的)。 |
lighter | 定义更细的字体。 |
bold | 定义粗体。 |
bolder | 定义更粗的字体。 |
100 200 300 400 500 600 700 800 900 |
定义由细到粗的字符。400 等同于 normal,700 等同于 bold。 |
inherit | fontWeight 属性的值从父元素继承。 |
support du navigateur
Tous les principaux navigateurs prennent en charge la propriété fontWeight.
Note: IE7 et les versions antérieures ne supportent pas la valeur "inherit".IE8 ne fournit DOCTYPE! Supporté "inherit". soutien IE9 "inherit".
Exemples
Exemples
Changer font-weight:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Titre> Ce tutoriel (w3big.com) </ title>
<Script>
fonction displayResult () {
document.getElementById ( "p1") style.fontWeight = "900" .;
}
</ Script>
</ Head>
<Body>
<P id = "p1"> Ceci est un texte. </ P>
<br>
<Bouton type = "button" onclick = "displayResult ()"> modifier poids police </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Titre> Ce tutoriel (w3big.com) </ title>
<Script>
fonction displayResult () {
document.getElementById ( "p1") style.fontWeight = "900" .;
}
</ Script>
</ Head>
<Body>
<P id = "p1"> Ceci est un texte. </ P>
<br>
<Bouton type = "button" onclick = "displayResult ()"> modifier poids police </ button>
</ Body>
</ Html>
Essayez »
style Objets