HTML (and XHTML) Base Templates
These templates are the templates that I use when I code a web page "from
scratch". It's best to put stylesheets in external .css files and JavaScript
code in .js files, but I've included <style>
and
<script>
elements because I often develop code that way
at the beginning and then when I'm closer to completion I move the stylesheets
and scripts to external files.
If you're developing a new site or project, you should probably use the HTML5 template.
Rememeber to change the charset when you're using a different character set
and to change the lang
attribute when the content will not
primarily be in English.
If you follow best practices and don't use any inline styles or inline event
handlers, then you don't need the Content-Style-Type
and
Content-Script-Type
<meta>
elements.
HTML 5
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript">
</script>
</body>
</html>
HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript"><!--
// -->
</script>
</body>
</html>
XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title></title>
<style type="text/css">/* <![CDATA[ */
/* ]]> */</style>
</head>
<body>
<script type="text/javascript"><!--//--><![CDATA[//><!--
//--><!]]>
</script>
</body>
</html>