CSS Tutorial – 12 – Text Properties

We’re now going to start looking at CSS properties.
The color property as we’ve already seen can set the color of text in one of five different
ways. By default its value set to inherit, meaning
it will inherit the color of its parent element. Text-transform controls the casing of text
and Text-decoration can add one or more decorations, such as underlining text.
Just like every other property it can use the inherit value, so I won’t include it here
unless it’s the default value for the property. Text-indent indents the first line of text
and text-align aligns text. Both text-indent and text-align can only be
used on block level elements, such as headers or paragraphs, while the other three can be
applied to any elements. If we look at an example we can set paragraphs
to be uppercased using text-transform and then underlined using text-decoration. To
add several decorations we can simply separate them with a space.
Text-indent can be set to an unit of measure, or a percentage of the parent elements width.
It can also indent text backwards using a negative value.
Finally, we can center the text using text-align. If we add an inline element such as,
and try to center it instead, it won’t work since text-align only works on block elements.

Add a Comment

Your email address will not be published. Required fields are marked *