2.5 Good HTML Style
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.
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.
Previous Section
2.4 Basic Tags In a WebpageNext Section
2.6 Style PracticeCopyright © 2021 Code 4 Tomorrow. All rights reserved.
The code in this course is licensed under the MIT License.
If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.