When using the
text-decoration shorthand property, omitted values are set to their initial values.
- Specifies what line decorations, if any, are added to the element. The following values are valid:
- Neither produces nor inhibits text decoration.
- Each line of text is underlined.
- Each line of text has a line over it.
- Each line of text has a line through the middle.
- The text blinks (alternates between visible and invisible). Note that this value is deprecated in favor of CSS animations.
- The style of the text decoration.
- A solid line.
- A wavy line.
- A dotted line.
- A line consisting of dashes.
- A double solid line.
- The color of the text decoration. Can be any valid color.
In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:
- Represents the value specified as the property's initial value.
- Represents the computed value of the property on the element's parent.
- This value acts as either
initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.
Basic Property Information
Here's an example of a basic declaration. A declaration consists of the property and its values for the various longhand properties.
Any omitted values are set to their initial value. So the following is also valid.
In fact, this is the only syntax recognized by CSS1 and CSS2 (as they don't support the longhand properties).
So, you could use the following code to provide CSS3 features, while still providing backwards compatibility for CSS1 and CSS2 browsers:
In CSS1 and CSS2 browsers, both the link text and its underline will be orange. Its underline will be solid (this is the only option prior to CSS3).
In CSS3 browsers, the link text will be orange and its underline will be green. Its underline will also be dotted.
Working Example within an HTML Document
- CSS Text Decoration Module Level 3 (W3C Candidate Recommendation 1 August 2013)
- CSS Level 2.1 (W3C Recommendation 07 June 2011)
- CSS Level 1 (W3C Recommendation 17 Dec 1996)
The following table provided by Caniuse.com shows the level of browser support for this feature.