Latest web development tutorials

HTML DOM propiedad Estilo fontWeight

Estilo de referencia de objetos Objetos de estilo

Definición y Uso

fontWeight conjuntos de propiedades o devuelve el peso de la fuente.

gramática

Configuración de las propiedades fontWeight:

Object.style.fontWeight="value"

Volver propiedades fontWeight:

Object.style.fontWeight

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


Soporte para el navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los principales navegadores soportan la propiedad fontWeight.

Nota: Internet Explorer 7 y versiones anteriores no son compatibles con el valor "heredar".IE8 sólo proporciona! DOCTYPE apoyado "hereda". apoyo IE9 "hereda".


Ejemplos

Ejemplos

Cambiar font-weight:

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

<P id = "p1"> Esto es un texto. </ P>
<br>
<Botón tipo "botón" = onclick = "displayResult ()"> modificar el peso del texto </ botón>

</ Body>
</ Html>

Trate »


Estilo de referencia de objetos Objetos de estilo