(Almost) empty index.html file

html

Solution

Indeed the first line of code is the minimum valid HTML5 code. `<!DOCTYPE html><title> </title>`

Though you must have a title, wether that be a space or text. Otherwise use the full declaration if you do not wish to give a title in order to be valid markup.

This can be verified using the W3C validator

Problem

When using a almost empty file named `index.html` in my apache directories in order to avoid directory listings (e.g. /image folder), what is the minimum content of this file? Can it be empty, or should I include something like: ``` <!DOCTYPE html><title></title> ``` or ``` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> </head> <body> &npsp; </body> </html> ``` or something in between?

Original source

Related problems