0

Space before and after <p> element

Hello everybody! I have a question. I am a bit confused about the space before and after the <p> element. If I want to add a paragraph, I should write the <p> element. --> <p>This is a paragraph.</p> But is this notation also right? --> <p> This is a paragraph. </p> Are spaces before and after <p> elements allowed? Thank you! Greets Imane

16th Oct 2018, 7:00 AM
Imane
Imane - avatar
2 Respuestas
+ 5
They are allowed, but they will typically be truncated in the browser output (unless you override that default behavior).
16th Oct 2018, 9:44 AM
Janning⭐
Janning⭐ - avatar
0
Hi Imane , what you are confused about is called white space collapsing. A browser automatically corrects any extra space between words in between elements. That's why it won't display your normal line break using enter key unless you use the <br/> element You can take the advantage to make your code easier to read and neat. .
16th Oct 2018, 10:31 AM
Precious
Precious - avatar