CSS Text

Subject: css

CSS Text

CSS text properties allow developers to style and control the appearance of text within HTML elements. These properties enhance readability, emphasize design, and improve visual structure on web pages.


Common CSS Text Properties

  • text-align: Aligns the text horizontally (left, right, center, justify)
  • text-decoration: Adds lines to text such as underline or line-through
  • text-transform: Controls capitalization (uppercase, lowercase, capitalize)
  • letter-spacing: Adjusts space between letters
  • word-spacing: Adjusts space between words
  • line-height: Controls vertical spacing between lines
  • text-indent: Indents the first line of text

Example: CSS Text Styling


text-align Values

  • left: Aligns text to the left (default)
  • right: Aligns text to the right
  • center: Centers the text horizontally
  • justify: Aligns text evenly on both margins

text-decoration Values

  • none: No decoration
  • underline: Underlines the text
  • overline: Adds a line above the text
  • line-through: Strikes through the text

Key Takeaways

  • text-align manages horizontal alignment
  • text-decoration applies underlines or lines above/below/through text
  • text-transform modifies capitalization style
  • letter-spacing and word-spacing adjust text spacing
  • line-height controls vertical spacing between lines
  • text-indent creates indentation for paragraph starts
  • CSS text properties enhance readability and user experience by managing layout and spacing effectively.