Content-Type Header

And Other HTTP Headers for HTML

HTTP headers are sent to the client (browser) in the response from the web server before the document itself. The HTTP headers which control how an HTML document is displayed might look like this:

Content-Type: application/xhtml+xml; charset=UTF-8
X-UA-Compatible: IE=9

For static web pages, the headers are provided by the HTTP web server.

When a server-side program or scripting is generating HTML, the language probably has an API to send the proper HTTP headers.