+ 2
HTML tags on different lines?
Hi, total beginner here. Do I need to put the opening tag on one line, then go to the next line(s) and add the content, then put the closing tag on another new line below (so the first and last lines have only the tags and the content is clearly separated) or can I put everything on one single line? Or may it simply be that keeping the opening/closing tags on their own lines is just meant to keep the code neat and clearly readable? Thanks!
5 Respostas
+ 8
Giovanni Damiani
Html is case insensitive - meaning lines of code doesn't matter.
E.g
<p>My name is Jane</p>
and
<p>
My name
is
Jane
</p>
are the same no matter where they are placed unlike other languages.
So it doesn't matter where you tags are placed, it doesn't affect your code but arranging the codes in other is best way to present your code in public.
+ 5
Multiple lines mostly improve human readability.
+ 2
Depends on the size of the content. Personally, a short sentence would go all on one line.
<p> Hello, World! </p>
But a long paragraph would go on multiple lines.
<p>
paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph paragraph
</p>
+ 1
Thank you very much for the answers!!
0
Koder King Case insensitivity is not the same as whitespace being ignored. Case insensitivity means THIS and this are seen the same.