HTML DOM propiedad Estilo fontVariant
Definición y Uso
conjuntos de propiedades fontVariant o devoluciones si se muestra mayúsculas pequeñas.
Esto significa que todas las letras minúsculas se convierten en mayúsculas, pero en comparación con el resto del texto, la carta será un tamaño de letra más pequeño.
gramática
Configuración de las propiedades fontVariant:
Object.style.fontVariant="normal|small-caps|inherit"
Volver propiedades fontVariant:
Object.style.fontVariant
值 | 描述 |
---|---|
normal | 默认。字体是 normal(正常的)。 |
small-caps | 字体显示为小型大写字母。 |
inherit | fontVariant 属性的值从父元素继承。 |
Soporte para el navegador
Todos los principales navegadores soportan la propiedad fontVariant.
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
Cambie la fuente a small-caps:
<! DOCTYPE html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
displayResult función () {
document.getElementById ( "P1") style.fontVariant = "small-caps" .;
}
</ Script>
</ Head>
<Cuerpo>
<P id = "p1"> Esto es un texto. </ P>
<P> Esto es un texto. </ P>
<br>
<Botón type = "button" onclick = "displayResult ()"> Cambiar fuente botón </>
</ Body>
</ Html>
<Html>
<Head>
<Charset Meta = "UTF-8">
<Title> Este tutorial (w3big.com) </ title>
<Script>
displayResult función () {
document.getElementById ( "P1") style.fontVariant = "small-caps" .;
}
</ Script>
</ Head>
<Cuerpo>
<P id = "p1"> Esto es un texto. </ P>
<P> Esto es un texto. </ P>
<br>
<Botón type = "button" onclick = "displayResult ()"> Cambiar fuente botón </>
</ Body>
</ Html>
Trate »
Objetos de estilo