Wednesday, 27 May 2009

Tell the browser the HTML/XHTML version and character encoding you're using :)

If you're using the HTML 4.01 version, you should write this information at the very beginning of your html document. The browser will 'know' that your website meets the standard :)

<!DOCTYPE html PUBLIC "-//W3//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

For the XHTML 1.0 version type:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

When using XHTML write xmlns attribute in your <html> opening tag:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

If you're using English or Western-European languages, write a <meta> tag that provides your browser with such information. This should be written inside the <head> element.

<meta http-equiv="Content-Type" content ="text/html; charset=ISO-8859-1">

Additional information about character encoding in other languages is on W3C website.

No comments:

Post a Comment