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

30th Jul 2019, 10:42 PM
Provolinen
Provolinen - avatar
5 Antworten
+ 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.
31st Jul 2019, 12:13 AM
Jella
Jella - avatar
+ 5
Multiple lines mostly improve human readability.
31st Jul 2019, 3:26 AM
Sonic
Sonic - avatar
+ 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>
31st Jul 2019, 8:45 AM
TheAmazingCoder2307
+ 1
Thank you very much for the answers!!
31st Jul 2019, 8:20 AM
Provolinen
Provolinen - avatar
0
Koder King Case insensitivity is not the same as whitespace being ignored. Case insensitivity means THIS and this are seen the same.
15th Aug 2019, 12:46 PM
TheAmazingCoder2307