HTML5 version is declared via:
<!doctype html>
HTML4.01:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
Place in HEAD tag (CHARSET is one among of defined by http://www.iana.org/assignments/character-sets):
<meta http-equiv="Content-Type" content="text/html; charset=CHARSET">
or in HTML 5:
<meta charset="utf-8">
See:
Client may suggest preferred language to server via Accept-Language HTTP tag:
Accept-Language: da, en-gb;q=0.8, en;q=0.7
W3C best practice suggest to surround corresponding text pieces in tag with lang attribute. Attribute values are from BCP 47.
It is good to set language in html tag:
<html lang="en">
HTML 4.01 require type attribute in CSS and JS linking tags:
<link rel="stylesheet" type="text/css" href="path-to.css"> <style type="text/css">...</style> <script type="text/javascript" src="abc.js"></script> <script type="text/javascript">...</script>
HTML 5 makes type attribute unnecessary when declaring or linking to external CSS / JS:
<link rel="stylesheet" href="path-to.css"> <style>...</style> <script src="abc.js"></script> <script>...</script>
In HTML 5 attribute values only need to be quoted if they contain spaces or some non-alphanumeric characters.
Example:
<div itemscope itemtype="http://schema.org/Person"> My name is <span itemprop="name">Random Hacker</span>, And I'm a <span itemprop="jobTitle">software developer</span> </div>
HTML 5 add video and audio tags and corresponding JS API to support video and audio playback.
To center block-level element:
<div style="margin-left: auto; margin-right: auto; position: relative; width: 700px;"> <div>SOME</div> </div>
To center inline element:
<p style="text-align: center;">TEXT</p>