CSS text properties
With CSS text properties, you can define how text is displayed. You can specify the color of text, alignment of text, and more.
This tutorial focuses on:
- Setting text color
- Aligning text
- Decorating text
- Setting letter spacing
Setting text color
Text color is set with the color property. You can specify the color of text with a color name, an RGB value, or a hexadecimal value.
This text is green
This text is darkblue
This text is darkslategray
The alignment of text in an element is set with the text-align property. With this property, you can set text to align to the left, right, or center.
This text is aligned to the left
This text is aligned to the right
This text is aligned to the center
Text decoration is set with the text-decoration property. With this property, you can set text to be underlined, have an overline, and more.
This text is underlinedLandofcode.com main page
This text has a line through it
This text is blinking
Setting letter spacing
Letter spacing is set with the letter-spacing property. You can increase or decrease the letter spacing between text with this property. The letter-spacing property takes the value "normal" for normal spacing between text characters or a numeric attribute specified by pixels followed by "px" for a fixed space between text characters.
The characters in this paragraph have normal spacing
The characters in this paragraph have a spacing of 5 pixels
The characters in this paragraph have a spacing of 10 pixels
The characters in this paragraph have a spacing of 15 pixels