About Lesson
The Best practice to write HTML code
- Always Declare Document Type
- Use Lowercase Element Names
- Close All HTML Elements
- Use Lowercase Attribute Names
- Always Quote Attribute Values
- Always Specify alt, width, and height for Images
- Do not add blank lines, spaces, or indentations without a reason.
- Close Empty HTML Elements?
In HTML, it is optional to close empty elements.
<meta charset=”utf-8″> & <meta charset=”utf-8″ /> both are allowed.
If you expect XML/XHTML software to access your page, keep the closing slash (/), because it is required in XML and XHTML. - Add the lang Attribute
You should always include the lang attribute inside the <html> tag, to declare the language of the Web page. like <html lang=”en-us”>. This is meant to assist search engines and browsers. - Use Lower Case File Names
HTML files should have a .html extension (.htm is allowed). - Default Filenames of a server are “index.html”, “index.htm”, “default.html”, or “default.htm”.