Propiedad de decoración de texto CSS
Ejemplo
Establezca diferentes decoraciones de texto para los elementos <h1>, <h2> y <h3>:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
h4 {
text-decoration: underline
overline;
}
Más ejemplos de "Pruébelo usted mismo" a continuación.
Definición y uso
La text-decoration
propiedad especifica la decoración añadida al texto y es una propiedad abreviada para:
- línea de decoración de texto (obligatorio)
- texto-decoración-color
- estilo de decoración de texto
Valor por defecto: | ninguno color actual sólido |
---|---|
Heredado: | No |
Animable: | no, ver propiedades individuales . Leer sobre animable |
Versión: | CSS1, renovado en CSS3 |
Sintaxis de JavaScript: | objeto .style.textDecoration="subrayado" |
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con la propiedad.
Property | |||||
---|---|---|---|---|---|
text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Sintaxis CSS
text-decoration: text-decoration-line text-decoration-color
text-decoration-style|initial|inherit;
Valores de propiedad
Value | Description |
---|---|
text-decoration-line | Sets the kind of text decoration to use (like underline, overline, line-through) |
text-decoration-color | Sets the color of the text decoration |
text-decoration-style | Sets the style of the text decoration (like solid, wavy, dotted, dashed, double) |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Más ejemplos
Ejemplo
Agregue más decoración de texto:
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy
blue;
}
páginas relacionadas
Tutorial CSS: Texto CSS
Referencia HTML DOM: propiedad textDecoration