Skip to main content

Style Properties for Text

The most common selectors apply to text and the most useful properties are included in the table below:

Property Description
background sets the background colour for the text
color sets the colour for the text
font-family sets the font type for the text
font-size sets the size for the font and can be measured in points or a percentage of another tag, or xx-small to xx-large
font-style normal or italic - normal is the default
font-weight extra-light to extra-bold
text-align left, right, center or justify
text-indent indent from margins and is measured as a fixed size or a percentage
text-decoration none, underline, overline, strikethrough

Note: It is important to know that once you start using a style sheet then every HTML tag element used within a document should be included in the style sheet. Even experienced Web page authors get caught-out when adding new elements to an existing Web page and the tags are not included in the style sheet and the presentation results are not what was expected.