Computer >> Computer tutorials >  >> Programming >> CSS

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 −

<!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

text-justify Property in CSS

Now, resize the browser −

text-justify Property in CSS