CSS Text Alignment and Transformation Styles


  In CSS, you can control the alignment, transformation, spacing, and line height of text to make it more readable and visually appealing.


Syntax


The basic syntax for text alignment in CSS is:
text-align: left | center | right | justify;

Example:


h1 { text-align:"center" }


You can also adjust text transformation, letter spacing, and line height with:
text-transform: uppercase | lowercase | capitalize;
letter-spacing: [value]px;
line-height: [value];


Purpose


Text styles in CSS help improve readability and make content visually appealing. Some examples include:


  • Centering headings and other content.
  • Applying uppercase transformations to buttons and titles.
  • Spacing out letters in logos for a unique style.
  • Adjusting line height for better readability.


Exercises



The rest of the content is available only for registered and premium users!



Which of the following is a property for aligning text in CSS?