Text Alignment in CSS: Tips, Tricks, and Best Practices

image of blog Pawan Sharma

Head of Operations

1 Minutes Read

Listen to the Blog

The text-align property in CSS is used to set the horizontal alignment of text within an element. It works for block-level elements such as <p>, <div>, <h1>, etc. Here are the common values for text-align:

  1. left: Aligns the text to the left. This is the default setting.
  2. right: Aligns the text to the right.
  3. center: Centers the text horizontally within its container.
  4. justify: Stretches the text so that each line has equal width, aligning both left and right edges.
Basic Text Alignment Using text-align

HTML Example:

As the Head of Operations (Hubspot CMS) at the Code Accelerator, I bring over 8 years of diverse experience in the realm of digital operations and content management. My journey in the tech industry began with a fervent passion for optimizing processes and enhancing user experiences. Over the years, I've honed my skills in leveraging Hubspot CMS to streamline operations and drive impactful results.

Get Started Today

Ready to streamline your Hubspot CRM, website, or RevOps !