Is the spacing important? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is the spacing important?

The way they themselves have written the code. Like it is not directly beneath each other but in a kind of a sequence. Like the <html> tag in the top most left corner as starting but the body tag kind of moves towards the middle. Are you supposed to keep a certain distance or can you just write the codes beneat eachother like <html> <head> </head> <body> </body> Rather than how they show <html> <head> </head> <body> This is the first line of text. </body> </html>

3rd Jun 2019, 9:54 PM
Saleha Shahid
Saleha Shahid - avatar
5 Answers
+ 2
You mean indentation? Typing(){ like this} ; Instead of Typing(){like this}; HTML ignores whitespace, paragraphs, spaces and indentation, it's only there so the code is easy to read - oftentimes you'll work on a group project and these are just common practices - it varies from language to language, from dev to dev and from company to company. If you wish you can write all your HTML in a single line, the page will be displayed just the same!
3rd Jun 2019, 11:06 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 5
Depends on who/what reads the code.
4th Jun 2019, 1:31 AM
Sonic
Sonic - avatar
+ 3
What spacing? Please clarify your question.
3rd Jun 2019, 10:18 PM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 1
Spacing is not necessary in HTML. It's only used to increase readability.
3rd Jun 2019, 11:04 PM
Diego
Diego - avatar
+ 1
Adding: If you're not planing to work with others, you can type it the way you like, SoloLearn is just showing the most common use
3rd Jun 2019, 11:07 PM
HNNX 🐿
HNNX 🐿 - avatar