A Guide to HTML Coding for the DevOps Course
This is the guide for HTML coding standards and recommended practices for a DevOps course, built by Dr. Eugene Callahan and his Spring 2018 DevOps class at NYU Tandon.
Don't create "hand" styles: use the stylesheet!
Hand styles violate the DRY principle! They are a terrible maintenance issue: imagine NYU mandates that all class websites use violet text. We change the stylesheet, only to find people have created their own "styles" in dozens of individual documents.
Doh!
No use of editors that insert their own code
Programmers need to use a programming editor for many reasons; first of all, because they are built with our needs in mind. Programs like Word and Google Docs can edit HTML, but they "have their way" with your code. Try editing a 20-line HTML file with Word and see what happens!
Use spaces not tabs.
Indenting with tabs shows up differently for different people depending upon their editor settings: spaces will look the same for everyone. A good coding editor can convert tabs to spaces automatically.
Keep line length < 80.
People have small screens, or edit on a phone, or have their editor set to wrap at 80. Eighty is the line maximum for "approved" Python coding: we might as well use that for HTML.
Use the HTML5 outline feature.
This gives the user a quick summary of the page, and then lets them drill down on topics of their choice.
Keep structural tags on their own line.
This makes it easy to see the structure separately from the text. It also makes it easy to delete tags or text but not the other.
Indent each nested structural element 4 more spaces.
By visually nesting structures that are logically nested, we can more easily see the logical structure, and match end tags.