There is technically a lot of ways you can write an HTML document. You can capitalize all of the tag names. You can add a bunch of blank lines. You can indent however you want. You could even put everything in one long line of text.
But that is not the point of good programming! Programmers in the real world have to work in teams, and that means whatever code you write needs to be readable and follow conventions that everyone else follows.
Briefly scan through this HTML study guide to familiarize yourself with HTML conventions.
HTML Style Guide and Coding Conventions
A consistent, clean, and tidy HTML code makes it easier for others to read and understand your code. Here are some guidelines and tips for creating good HTML code. Always declare the document type as the first line in your document. The correct document type for HTML is: HTML allows mixing uppercase and lowercase letters in element names.
Another thing to remember is a proper indentation, which is important in HTML to shoe the document's structure. If an element is a container for another element (also called a parent element), make sure you indent the elements inside that container(child elements). For example, the head tag contains the title and meta tags. Thus, the title and meta tags should be indented 1 level inside of the head tag.
Note: If you are using an advanced test editor, it will typically indent for you whenever appropriate.