×
Course: CSS Basics

Text Formatting Properties [4/15]

In CSS, there is a huge variety of properties. They can be classified into the following groups:

  • Text formatting
  • Styling sizes and spaces
  • Element positioning
  • Layout creation
  • Decorative: color, background, shadow;
  • etc.

In this task, we'll get a first look at some properties related to text formatting in prep for more in-depth learning in the upcoming "Styling Text with CSS" course.


Do it
HTML
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Text Formatting Properties</title> </head> <body> <h1>Text Formatting and CSS</h1> <p>When you style text with CSS, the &lt;span&gt; tag with classes often comes in handy.</p> <p>For example, you can highlight words using <span class="underline">underline</span>, <span class="bold">bold</span> or <span class="italic">italics</span>.</p> <p class="bold">Also, beyond highlighting individual words you also can highlight whole paragraphs.</p> <p class="italic underline">Moreover, you even can combine different classes together.</p> </body> </html>
CSS
.underline { } .bold { } .italic { }
HTML Academy
  1. To the CSS rule for the underline class, add the text-decoration: underline; property.
  2. To the CSS rule for the bold class, add property font-weight: bold;.
  3. To the CSS rule for the italic class, add property font-style: italic;.

The properties we have been using here are detailed in the upcoming "Styling Text with CSS" course.

Theory Check Next