Categories
CSS Web development

CSS direction Property



CSS direction Property

The CSS direction property defines the text direction within a block-level element.

Demo:

Syntax:

direction: ltr|rtl;

ltr (default) – text direction goes from left-to-right.

rtl – text direction goes from right-to-left.

Example:

<!DOCTYPE html>
<html>
<head>
<style>

.example2 {
  direction: rtl;
}
</style>
</head>
<body>

<p>This text goes from left to right.</p>

<p class="example2">This text goes from right to left.</p>

</body>
</html>

Output:

This text goes from left to right.

This text goes from right to left.


Enjoy coding!

Read also:

CSS flex Property

CSS grid Property

CSS line-height Property