Style fontVariantPropiedad
Objeto Style
Definición y uso
La propiedad fontVariant establece o devuelve si la fuente se muestra en versalitas.
Esto significa que todas las letras minúsculas se convertirán en mayúsculas, pero en comparación con el resto del texto, dichas letras tendrán un tamaño de fuente menor.
Sintaxis
Establecer la propiedad fontVariant:
Object.style.fontVariant="normal|small-caps|inherit"
Devolver la propiedad fontVariant:
Object.style.fontVariant
| Valor | Descripción |
|---|---|
| normal | Por defecto. La fuente es normal (normal). |
| small-caps | La fuente se muestra en versalitas. |
| inherit | El valor de la propiedad fontVariant se hereda del elemento padre. |
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales soportan la propiedad fontVariant.
Nota:IE7 y versiones anteriores no admiten el valor "inherit". IE8 solo admite "inherit" si se especifica el !DOCTYPE. IE9 admite "inherit".
Ejemplo
Ejemplo
Cambiar la fuente a versalitas:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de novatos (example.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.fontVariant="small-caps";
}
</script>
</head>
<body>
<p id="p1">This is some text.</p>
<p>THIS IS SOME TEXT.</p>
<br>
<button type="button" onclick="displayResult()">Modificar fuente</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de novatos (example.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.fontVariant="small-caps";
}
</script>
</head>
<body>
<p id="p1">This is some text.</p>
<p>THIS IS SOME TEXT.</p>
<br>
<button type="button" onclick="displayResult()">Modificar fuente</button>
</body>
</html>
Pruébalo »
Objeto Style Otras extensiones