Why is the </p> all the way to the end and not when the sentance ends in this example? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why is the </p> all the way to the end and not when the sentance ends in this example?

example: <p align="center"> This is a text. <hr width="50%" align="left" /> </p> And why not like this <p align="center"> This is a text. </p> <hr width="50%" align="left" />

3rd Mar 2018, 3:14 AM
Stephanie Albino
Stephanie Albino - avatar
1 Answer
+ 3
Hi Stephanie, putting the closing tag in a new line is just a matter of preference and readability. <p> This is a text </p> is the same as <p> This is a text </p> The second one is much better for readability especially if there are lots of nested elements. Regarding the <hr> tag, it's also a matter of preference depending on your desired results.
3rd Mar 2018, 3:33 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar