text-justify Property in CSS



The text-justify property in CSS is used to set the justification method of text when the text-align property is set to the justify value. Following are the property values −

text-justify: auto|inter-word|inter-character|none|initial|inherit;

Example

Let us now see an example to implement the text-justify property in CSS −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
div {
   text-align: justify;
   text-justify: inter-word;
   color: white;
   background-color: gray;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<div>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. </div>
</body>
</html>

Output

Now, resize the browser −


Advertisements