Justify content of a variable

0

I'm working with texts, reading what was typed by the user and saving in the subject variable. I would like, when the variable was called, its contents would be shown on the screen with justified alignment. But I have tried in some ways like:

echo "<div style='text-align: justify;'>".$assunto."</div>";

echo "<p align='justify'>".$assunto."</p>";

And I had no results. How can I do to show the contents of a variable with justified alignment?

    
asked by anonymous 18.09.2017 / 16:21

1 answer

2

It's by CSS, just like you tried to do in the first example, but it's just justify , not justifictify . Here's an example:

p {
  text-align: justify;
}
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam non gravida nisi. Fusce in nisi ut lorem aliquam tempus. Mauris aliquet maximus nulla a luctus. Etiam finibus nisl quis dignissim lacinia. Praesent arcu nunc, tristique quis dui eu, finibus ultrices lorem. Proin eget leo ultricies, scelerisque nulla et, blandit metus. Aliquam tincidunt lorem neque, sit amet maximus nulla cursus in. Nullam vel odio rhoncus, accumsan elit et, aliquam diam. Duis et leo vel metus iaculis tincidunt non a lacus. Nulla a feugiat augue, ut tincidunt erat. Maecenas nec interdum odio, eu luctus risus. Suspendisse sed erat lectus. Proin fermentum consequat justo sit amet imperdiet. Vestibulum tellus eros, facilisis nec imperdiet non, consectetur id turpis. Sed tempus congue mauris nec sagittis. Suspendisse at ante sit amet metus consectetur accumsan.</p>
<p>Ut aliquet tincidunt odio, nec sodales est. Cras faucibus vestibulum urna, nec tincidunt nisi iaculis et. Ut condimentum nunc eu sapien pharetra, vel pretium risus interdum. Suspendisse gravida leo at tellus gravida, sit amet rhoncus eros sagittis. Sed tristique ante lectus. Phasellus a malesuada lacus. Sed nec eros eu nibh scelerisque laoreet. Mauris non lacus vel ex maximus varius at auctor mi. Morbi nunc augue, iaculis eget libero id, efficitur dapibus sem. Integer viverra, neque quis egestas consectetur, massa elit sollicitudin orci, vel dapibus diam nibh ac arcu. Nulla tristique quis mi in facilisis. Nulla arcu ipsum, ullamcorper vel dictum ac, pharetra et ligula. Nullam congue vestibulum bibendum. Suspendisse aliquet porta mauris nec mattis. Morbi tempus eros sed dolor molestie convallis ac sit amet enim.</p>
    
18.09.2017 / 16:28