Frontend Engineering, Volume II

CSS: Example 1a—Make a Template

© 2013, Martin Rinehart

If you made a template following the prescription in Pro HTML, you can continue using it here (but see Validation). If not, follow these directions.

Validation The old doctypes are now replaced by the new, WHATWG-recommended simple doctype. The <html> tag now sports a lang attribute for the new internationalization standard. The <meta charset="UTF-8"> ...> tag is now easier and more clear. The <style> tag no longer needs the rel='stylesheet' attribute (which was silly—styles go inside <style> tags, of course) but still needs a type='text/css' attribute (which is equally silly) to avoid a warning from the W3C validator.

Create an empty file, template.html and copy the content of the above textarea into it.

When you start an HTML page, you simply copy your template, replace folder with the path to your page, the first ??? with the name of your page and the other ??? with a sentence or so explaining the purpose of the page. Adding something sensible to the <title> is also a good idea.

Save your template in two places, one handy and the other not so handy.

When it's time to use your template, copy the handy one. When you make a mistake and destroy your template by saving it with specific values, it's time to rescue yourself with a copy of the less handy template.

Feedback: MartinRinehart at gmail dot com

# # #