Last active
September 19, 2024 10:19
-
-
Save cmalven/1885287 to your computer and use it in GitHub Desktop.
Shortest (useful) HTML5 Document
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- http://www.brucelawson.co.uk/2010/a-minimal-html5-document/ --> | |
<!doctype html> | |
<html lang=en> | |
<head> | |
<meta charset=utf-8> | |
<title>blah</title> | |
</head> | |
<body> | |
<p>I'm the content</p> | |
</body> | |
</html> |
if we're talking about a minimal HTML document, it's certainly not required - but doesn't really seem like a good idea either way.
Now imagine serving files with different encodings off the same web server.
Encoding is inalienable from the document itself. You can't usefully change the encoding without changing the text.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UTF-8 is the only valid encoding for HTML5 documents. Means if you have
<!DOCTYPE html>
at the top of an HTML file then charset is implied