Latest web development tutorials

propriedade HTML DOM Estilo fontWeight

Estilo Object Reference estilo Objects

Definição e Uso

fontWeight conjuntos de propriedades ou retorna o peso da fonte.

gramática

Definindo as propriedades fontWeight:

Object.style.fontWeight="value"

Propriedades volta fontWeight:

Object.style.fontWeight

描述
normal 默认。字体是 normal(正常的)。
lighter 定义更细的字体。
bold 定义粗体。
bolder 定义更粗的字体。
100
200
300
400
500
600
700
800
900
定义由细到粗的字符。400 等同于 normal,700 等同于 bold。
inherit fontWeight 属性的值从父元素继承。


Suporte a navegadores

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos os principais navegadores suportam propriedade fontWeight.

Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".


Exemplos

Exemplos

Alterar font-weight:

<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "utf-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
displayResult function () {
document.getElementById ( "P1") style.fontWeight = "900" .;
}
</ Script>
</ Head>
<Body>

<P id = "p1"> Este é um texto. </ P>
<br>
<Button type = "button" onclick = "displayResult ()"> modificar peso da fonte </ button>

</ Body>
</ Html>

tente »


Estilo Object Reference estilo Objects