Learn something new every day
More Info... by email
The best tips for hypertext markup language (HTML) formatting include specifying a document type declaration, adding good metadata keywords for better search engine optimization (SEO), and following a consistent system of indentation to make HTML formatting easier for others to read. Writing good HTML code also entails following a set of rules for nesting tags in the correct order, which sometimes takes some extra attention to detail. Adding specific comments throughout an HTML document is an additional good formatting tip that streamlines the editing process. Learning good HTML formatting is usually considered a fundamental part of the web design process.
HTML coding in a new document often begins with a declaration that indicates which type of HTML tags will be used in the document. The three most common document type declarations are called HTML Strict, HTML Transitional, and HTML Frameset. Including one of these declarations is essential for checking an HTML document with a validation tool that is designed to check for coding errors.
Many professional web developers recommend using the HTML Strict declaration whenever possible. The HTML Transitional document declaration can be used in cases when the web designer uses elements from different versions of HTML. An example would be a document written mostly in HTML 4 with a few added features coded in HTML 5.
Metadata keywords are one of the most important elements of a website that will rank well in major search engines. These keywords are also one area of HTML formatting that many web designers overlook or fail to plan thoroughly enough. Inserting specific and relevant keywords in the metadata tags often makes a significant difference in bringing targeted visitors to a site based on similar phrases that they type into a search engine.
A common HTML formatting mistake for beginning web developers is to keep every line of code left-justified in their HTML editors. While this practice saves time in indenting HTML elements, it results in HTML documents that are difficult to decipher. Incorrect indentation can also sometimes lead to inaccurate editing when other designers check an HTML document for mistakes, and these missed errors can even cause a web page to render incorrectly in a browser. A general rule for indentation is that only opening and closing tags should be left-justified with their HTML contents indented with at least one tab space.
Proper tag nesting is also essential for correct HTML formatting. Closing tags of a line of HTML code generally need to be typed in the same logical order as their corresponding opening tags. This formatting step often takes some practice with lines of HTML code that contain several nested elements.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!