Minimal HTML

T

Toby Inkster

Today's challenge is to create the smallest *valid*[1] HTML file possible.

So far I have one that's 60 bytes, but I reckon someone here must be able
to do better!

[1] validated by the W3C validator in any DOCTYPE that it understands. It
must be declared as valid with no manual over-rides and no "Tentatively".
 
D

David Dorward

Toby said:
Today's challenge is to create the smallest *valid*[1] HTML file possible.

So far I have one that's 60 bytes

Oh dear. HTML Golf. I'm doomed.

I can't seem to beat 68 bytes.
 
M

Michael Winter

On Wed, 24 Nov 2004 21:56:10 +0000, Toby Inkster

[snip]
So far I have one that's 60 bytes, but I reckon someone here must be
able to do better!

Presumably,

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><title//.

which is 55 bytes is the smallest possible.

Is there a prize? :)

Mike


By the way, I validated this off my own web server, so I'm reluctant to
give a URL: the server is for personal testing purposes only as I'm on
dial-up. If anyone does know how to configure Zeus to send the encoding
along with content-type, I could put it on my ISP's web server.
 
M

Mark Parnell

Previously in alt.html,alt.www.webmaster, Toby Inkster
Today's challenge is to create the smallest *valid*[1] HTML file possible.

So far I have one that's 60 bytes, but I reckon someone here must be able
to do better!

Nope, best I can do is 61 bytes. Well, it only tentatively validates,
but that's only because my host won't send out a character encoding with
the page. :-/
 
M

Mark Parnell

Previously in alt.html,alt.www.webmaster, Michael Winter
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><title//.

which is 55 bytes is the smallest possible.

Nicely done.
If anyone does know how to configure Zeus to send the encoding
along with content-type, I could put it on my ISP's web server.

Sorry, I have exactly the same problem. :-( If you find out, let me
know. :)
 
R

rf

Michael Winter
Presumably,

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><title//.

which is 55 bytes is the smallest possible.

Fires quirks mode in a certain browser.
 
M

Michael Winter

Michael Winter


Fires quirks mode in a certain browser.

Toby said nothing about utility, just validity. :p

For the record, none of the browsers I have to hand at the moment parse
that "document" properly. Gecko browsers seem to act the most
intelligently, but they still fail to produce the expected tree.

Anyway, someone mind telling me the point of this? :)

Mike
 
T

Toby Inkster

Michael said:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><title//.

Dammit. Mine was:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><title//<p>

I also had:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><title//.

But in strict you can't use "<title//." because the body element isn't
allowed to contain inline text -- only block elements.

Good choice of DOCTYPE too. I couldn't think of a shorter one than HTML
4.0.
 
D

Duende

While sitting in a puddle Michael Winter scribbled in the mud:
Toby said nothing about utility, just validity. :p

For the record, none of the browsers I have to hand at the moment parse
that "document" properly. Gecko browsers seem to act the most
intelligently, but they still fail to produce the expected tree.

Anyway, someone mind telling me the point of this? :)

beats working.
 
J

Jukka K. Korpela

Michael Winter said:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><title//.

which is 55 bytes is the smallest possible.

Somewhat debatably, no. If you replace PUBLIC with SYSTEM and the quoted
string with a quoted URL that points to the HTML 2.0 DTD, you get a
shorter document if you can get a short enough URL. I have no
sufficiently short URL right now at my disposal, but the following is a
proof of concept:

<!DOCTYPE HTML SYSTEM
"http://www.w3.org/MarkUp/html-spec/html-1.dtd"><title//.

So if you replace the quoted string by an absolute URL that redirects to
the same address, or points to a copy of the DTD, you should get below 55
bytes. I wonder if some http://x.xx (where x's are letters) would be
available for this important purpose.

It would still be a conforming HTML 2.0 document, since HTML 2.0 requires
conformance to the HTML 2.0 DTD, not the use of a particular DOCTYPE
declaration (or any DOCTYPE declaration for that matter - but the
assignment said the validator should accept the document by its default
rules).
 
M

Michael Winter

You're the second person to quote me that way. The first word I wrote was
"Presumably". I was certain that someone could outdo me...
[...] If you replace PUBLIC with SYSTEM and the quoted string with a
quoted URL that points to the HTML 2.0 DTD, you get a shorter document
if you can get a short enough URL.

....and I was right.

[snip]

Mike
 
M

Michael Winter

Michael said:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><title//.
[snip]

But in strict you can't use "<title//." because the body element isn't
allowed to contain inline text -- only block elements.

I know, which was why I avoided it. Besides, it would have made the
DOCTYPE declaration longer.
Good choice of DOCTYPE too. I couldn't think of a shorter one than HTML
4.0.

To be honest, neither could I at first so I thought I'd do the sensible
thing and look at the list of accepted DOCTYPEs
(<URL:http://www.w3.org/QA/2002/04/valid-dtd-list.html>) for the W3C
Validator and used the shortest. :D

Mike
 
N

Nullcode

Jukka said:
Somewhat debatably, no. If you replace PUBLIC with SYSTEM and the quoted
string with a quoted URL that points to the HTML 2.0 DTD, you get a
shorter document if you can get a short enough URL. I have no
sufficiently short URL right now at my disposal, but the following is a
proof of concept:

<!DOCTYPE HTML SYSTEM
"http://www.w3.org/MarkUp/html-spec/html-1.dtd"><title//.

So if you replace the quoted string by an absolute URL that redirects to
the same address, or points to a copy of the DTD, you should get below 55
bytes. I wonder if some http://x.xx (where x's are letters) would be
available for this important purpose.

It would still be a conforming HTML 2.0 document, since HTML 2.0 requires
conformance to the HTML 2.0 DTD, not the use of a particular DOCTYPE
declaration (or any DOCTYPE declaration for that matter - but the
assignment said the validator should accept the document by its default
rules).

Damnit, I played with SYSTEM, but i neve rthought about changing the url :(
 
N

Nullcode

Jukka said:
Somewhat debatably, no. If you replace PUBLIC with SYSTEM and the quoted
string with a quoted URL that points to the HTML 2.0 DTD, you get a
shorter document if you can get a short enough URL. I have no
sufficiently short URL right now at my disposal, but the following is a
proof of concept:

<!DOCTYPE HTML SYSTEM
"http://www.w3.org/MarkUp/html-spec/html-1.dtd"><title//.

So if you replace the quoted string by an absolute URL that redirects to
the same address, or points to a copy of the DTD, you should get below 55
bytes. I wonder if some http://x.xx (where x's are letters) would be
available for this important purpose.

It would still be a conforming HTML 2.0 document, since HTML 2.0 requires
conformance to the HTML 2.0 DTD, not the use of a particular DOCTYPE
declaration (or any DOCTYPE declaration for that matter - but the
assignment said the validator should accept the document by its default
rules).

Assuming ftp is valid as a src, that will shave off another byte. Also
if the file extension doesnt have to be "dtd" you could shave off
another 2 or possibly 3 if a file extension is admitted[and allowed heh]

<!DOCTYPE HTML SYSTEM "ftp://x.tk/y.dtd"><title//. 50bytes
<!DOCTYPE HTML SYSTEM "ftp://x.tk/y"><title//. 46bytes
 
N

Nullcode

Jukka said:
Somewhat debatably, no. If you replace PUBLIC with SYSTEM and the quoted
string with a quoted URL that points to the HTML 2.0 DTD, you get a
shorter document if you can get a short enough URL. I have no
sufficiently short URL right now at my disposal, but the following is a
proof of concept:

<!DOCTYPE HTML SYSTEM
"http://www.w3.org/MarkUp/html-spec/html-1.dtd"><title//.

So if you replace the quoted string by an absolute URL that redirects to
the same address, or points to a copy of the DTD, you should get below 55
bytes. I wonder if some http://x.xx (where x's are letters) would be
available for this important purpose.

It would still be a conforming HTML 2.0 document, since HTML 2.0 requires
conformance to the HTML 2.0 DTD, not the use of a particular DOCTYPE
declaration (or any DOCTYPE declaration for that matter - but the
assignment said the validator should accept the document by its default
rules).

If ftp is valid as a src you could shave off a byte. Also possibly
another 4 if a file extention isnt needed.

<!DOCTYPE HTML SYSTEM "ftp://x.tk/y.dtd"><title//. 50bytes
<!DOCTYPE HTML SYSTEM "ftp://x.tk/y"><title//. 46bytes

Just some thoughts, im by no means someone who has a clue ;)
 
T

Toby Inkster

Nullcode said:
Assuming ftp is valid as a src, that will shave off another byte.

<!DOCTYPE HTML SYSTEM "ftp://x.tk/y.dtd"><title//. 50bytes
<!DOCTYPE HTML SYSTEM "ftp://x.tk/y"><title//. 46bytes

With URNs you can go smaller.

<!DOCTYPE HTML SYSTEM "urn:x"><title//.

But I don't think the W3C validator understands either of those URI
schemes.
 
J

Jukka K. Korpela

Nullcode said:
Assuming ftp is valid as a src,

I haven't checked what the validator thinks about ftp URLs there, but...
<!DOCTYPE HTML SYSTEM "ftp://x.tk/y"><title//. 46bytes

.... if you can control x.tk or equivalent, you can make the HTTP server
return a DTD in response to the request http://x.tk which is a byte shorter
than yours. I don't think you can make the same ("default the filename" to
speak loosely) with ftp URLs.
 
M

Mimic

Jukka said:
I haven't checked what the validator thinks about ftp URLs there, but...




... if you can control x.tk or equivalent, you can make the HTTP server
return a DTD in response to the request http://x.tk which is a byte shorter
than yours. I don't think you can make the same ("default the filename" to
speak loosely) with ftp URLs.

:D yeah i imagine you could, providing the validator doesnt need to see
the extension, or you coudl even mod the server config :p

--
Mimic

"In order to step out of the box, you must first be in the box."
"The voices have stopped now. But they had some good ideas."
"Pain is free and there to be enjoyed."
ZGF0YWZsZXhAY2FubmFiaXNtYWlsLmNvbQ== [ www.hidemyemail.net ]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top