These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:26 pm Advanced search

Shortest (X)HTML5 document

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

Shortest (X)HTML5 document

Postby zcorpan » Wed Aug 20, 2008 10:28 pm

Voici à ma connaissance la plus petite page web XHTML 5 valide (10 juin 2007):
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"><head><title/></head><body/></html>
total: 116 octets; page en question, validité de la page
Pour info, inutile d'essayer de lire le moindre document XHTML 5 avec Internet Explorer (6 ou 7), ce sera peine perdue. Tout document XHTML 5 doit être un document XML (avec donc un en-tête XML), & fourni par le serveur web comme un fichier XML (c'est-à-dire avec un header HTTP du type "Content-Type: text/xml"); IE ne peut lire ce genre de document.
Voici à ma connaissance la plus petite page web HTML 5 valide (9 juin 2007 - 4 août 2007):
<!DOCTYPE html><html><head><meta charset=utf-8><title></title></head><body></body></html>
je me suis rendu compte que je pouvais diminuer encore la taille de cette page en replaçant <meta charset="utf-8"/> par <meta charset=utf-8>; donc -3 octets
total: 89 octets; page en question, validité de la page
-- http://html5.fr/

Translated by Google:
Here's to my knowledge the smallest web page 5 valid XHTML (June 10, 2007):
<? xml version = "1.0" encoding = "UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title/> </ head> <body /> </ html>
Total: 116 bytes; page in question, validity of the page
For info, not try to read any document XHTML 5 with Internet Explorer (6 or 7), it will be useless. Any document XHTML 5 must be an XML document (with therefore a header XML), & provided by the web server as an XML file (ie with a header HTTP type "Content-Type: text / xml "); IE can not read this kind of document.
Here's to my knowledge the smallest HTML web page 5 valid (June 9, 2007 - August 4, 2007):
<! DOCTYPE html> <meta <html> <head> charset=utf-8> <title> </ title> </ head> <body> </ body> </ html>
I realized that I could still reduce the size of this page by placing <meta charset="utf-8"/> <meta charset=utf-8>, so -3 bytes
total: 89 bytes; page in question, validity of the page


To the best of my knowledge, the shortest XHTML5 document is
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"><head><title/></head><body/></html>
78 bytes

and HTML5:
Code: Select all
<!doctype html><title></title>
30 bytes
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Le Sage » Thu Aug 21, 2008 8:26 am

Hum... interesting...
I thought I had checked both of these before...
XHTML 5 :
Wasn't the XML file declaration an obligation before, did that change recently? I was sure it was. Image
HTML 5 :
funny, I was also sure both elements <html> & <heads> were mandatory too. I was also positive that declaring a charset was also an obligation. Image
I should read the specs again. Image

ADD: geez, I just realized many things moved since last time I read the specs, I don't understand anything anymore. So we're not supposed to use
Code: Select all
<meta charset="utf-8" />
anymore ?
Is there any document that would be similar to "HTML5 good pratices for dummies" somewhere on the web? The specs got definitely too hard for me to read now. Image
User avatar
Le Sage
<h3>
 
Posts: 54
Joined: Wed Dec 05, 2007 9:08 pm
Location: Casablanca, Morocco

Postby zcorpan » Thu Aug 21, 2008 1:46 pm

Le Sage wrote:Hum... interesting...
I thought I had checked both of these before...
XHTML 5 :
Wasn't the XML file declaration an obligation before, did that change recently? I was sure it was. Image
No, the XML declaration is optional (unless you use some encoding other than utf-8 or utf-16 and a higher-level protocol doesn't declare the encoding).
Le Sage wrote:HTML 5 :
funny, I was also sure both elements <html> & <heads> were mandatory too.
The elements are required, but the tags are optional (see #omitted in the spec).
Le Sage wrote:I was also positive that declaring a charset was also an obligation. Image
I should read the specs again. Image
You can declare the encoding with HTTP. However, if you're only using ASCII, I think you can get away with not declaring any encoding.

Le Sage wrote:ADD: geez, I just realized many things moved since last time I read the specs, I don't understand anything anymore. So we're not supposed to use
Code: Select all
<meta charset="utf-8" />
anymore ?
You can use it but you could also use the HTTP Content-Type header to set the encoding...
Le Sage wrote:Is there any document that would be similar to "HTML5 good pratices for dummies" somewhere on the web? The specs got definitely too hard for me to read now. Image
There's http://dev.w3.org/html5/html-author/ but it's not complete yet.

BTW, what changed in the spec that made it harder to read?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Le Sage » Fri Aug 22, 2008 8:41 am

All of this is very interesting, thanks for taking all that time for me.
I'll update (let's say a bit later) my webpage taking what you said into account.
I don't know if it's my memory or something else, but I remembered the specs to be organized in a different way : I thought the stuff about encoding was easier to read, & written at the beginning of the document.
User avatar
Le Sage
<h3>
 
Posts: 54
Joined: Wed Dec 05, 2007 9:08 pm
Location: Casablanca, Morocco

Postby JAB Creations » Wed Oct 08, 2008 7:34 am

I use the XML declaration for good merit. It also throws IE6 and earlier in to quirks mode which actually for my site produces more desirable behavior in place of IE's standards mode. Not that there is much desirability in IE6 in any mode though it's just I thought I'd add. :D
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests