Text & FontsCore· 35 min read

Styling Text

Alignment, decoration, transformation and spacing — the controls that make text readable and attractive.

What you will learn

  • Align and decorate text
  • Transform letter case
  • Adjust line height and letter spacing

The everyday text properties

PropertyDoesExample value
text-alignAlignmentcenter, right, justify
text-decorationUnderline / removeunderline, none
text-transformLetter caseuppercase, capitalize
line-heightSpace between lines1.6
letter-spacingSpace between letters2px
Alignment, case, spacing and decoration
<style>
  .title { text-align: center; text-transform: uppercase; letter-spacing: 3px; color:#4338ca; }
  .lead  { text-align: center; line-height: 1.8; color:#5b6178; }
  a.clean { text-decoration: none; color:#06b6d4; }
</style>
<h2 class="title">CodingClave</h2>
<p class="lead">Readable text uses generous line-height. This paragraph uses 1.8 so lines breathe.</p>
<a class="clean" href="#">A link with no underline</a>
Live preview

Each class shows off a different text control:

  • .titletext-align: center centres it, text-transform: uppercase forces CAPITALS even though the HTML is mixed-case, and letter-spacing: 3px pushes the letters apart for an airy heading.
  • .leadline-height: 1.8 adds generous vertical space between lines so the paragraph is easy to read.
  • a.cleantext-decoration: none removes the underline that links normally have, leaving just coloured text.

Tip: For body text, a line-height around 1.5–1.8 dramatically improves readability. Cramped lines are the most common beginner mistake.

Q. Which property removes the underline from a link?

Answer: text-decoration: none removes the default underline from links (and other decorations).

✍️ Practice

  1. Centre a heading, make it uppercase, and add letter-spacing.
  2. Set a comfortable line-height on a paragraph and compare with the default.

🏠 Homework

  1. Style all the text on your profile page: alignment, line-height and link decoration.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →