Cascading Style Sheets (CSS) describe how HTML displays elements on the screen.

CSS can control the layout of multiple web pages with a few lines of code.

CSS has formatting properties that affect the spacing, appearance, and alignment of text.

An illustration of two monitors side-by-side, next to a cup of coffee

Text Color

Thecolorproperty specifies the main foreground color of your text.

you might use a predefined color name likered,white, orgreen.

you might also use a hex value or other units like RGB, HSL, and RGBA.

CSS properties change text color

CSS frameworks likeTailwind CSShave a built-in color feature that displays a variety of shades.

This makes it easier for you to select a shade you prefer.

Background Color

you might use thebackground-colorproperty to createappealing backgrounds.

CSS sets background color of texts

Text Alignment

Thetext-alignproperty sets the horizontal alignment of text.

This value can beleft,right,center, orjustify.

Text Direction

Thetext-directionproperty defines the direction of text.

text-align properties on text

Define the direction using propertiesrtl(right to left) orltr(left to right).

These two specify which direction you want the text to flow.

For example, usertlwhen working with languages written from right to left like Hebrew or Arabic.

text-direction aligns text in different directions

You useltrfor languages written from left to right like English.

Text Decoration

Thetext-decorationproperty sets the appearance of decorative lines on text.

It’s shorthand fortext-decoration-line,text-decoration-color,text-decoration-style, andtext-decoration-thicknessproperty.

text decoration effect on text

Text Transform

Thetext-transformproperty specifies the jot down of case the letters appear.

This can be in uppercase or lowercase letters.

Letter Spacing

Theletter-spacingproperty specifies the space between the letters in text.

text tranform changes text to different cases

The following example illustrates how to specify different spacing styles.

Word Spacing

Theword-spacingproperty specifies the space between the words in a text.

Browsers have a standard length for space between words, but you’re able to set your own.

letter spacing allows for different spacing in text

Line Height

Theline-heightproperty specifies the spacing between lines in a paragraph.

The standard and default line height in most browsers is about 110% to 120%.

Text Shadow

Thetext-shadowproperty applies shadows to text.

word-spacing effect on text

You have to specify the horizontal shadow and the vertical shadow.Text-shadowcan include color and blur radius.

CSS is the backbone of modern web design.

Whether in its vanilla form or in frameworks, the basic function of CSS properties is the same.

lineheight property effect on text

Mastering text formatting properties allow you to create attractive and readable user interfaces.

The latest version of CSS, CSS3, introduces new concepts from animations to multiple-column layouts.

These concepts make it easier to create professional applications and documents.

text shadow effect on text