# Specifying alignment either to the left or right in CSS

ID: C19

Technology: css

Type: Technique

## When to Use

CSS

## Description

This technique describes how to align blocks of text either left or right by setting the CSS text-align property.

## Examples

### Aligning text to the left

In the following example, text is aligned left. In the style sheet, define the class:

    p.left {text-align: left}

In the content call the up the class.

    <p class="left"> Lorem ipsum dolor sit ...</p>

### Aligning text to the right

In the following example, text is aligned right.

    p.right {text-align: right}

In the content call the up the class.

    <p class="right"> Lorem ipsum dolor sit ...</p>

## Tests

### Procedure

1. Check that the text is aligned either left or right.

### Expected Results

- Check #1 is true.