1


In a search towards minimalistic webcoding practices I saw this on the top of my webpages:

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="nl"/>

A: when should one keep the second line (xmlns) and when can it be removed?

B: my website is multilingual so pages come in variety of languages. I kept the xmlns since I swa you can put in lang= and xml:lang= so thought that might be handy, but I don't use xml I think... just php generated contents etc. UPDATE I just got advise to use <html lang="de"> which will suffice for me. True?

C: when does one need the third line http-equiv? When can it be removed entirely?

D: do browsers recognize/process the fourth line or do they skip it nowadays?

Thanks very much!

Sam
  • 15,254
  • 25
  • 90
  • 145

1 Answers1

2

If you haven't already, read up on HTML5 here or maybe here, and maybe even here. HTML5 is the latest HTML spec currently under development by the W3C, and is pretty much awesome.

For your questions:

Q1: See this SO question. Basically, you won't need the xmlns or xml:lang attribute.

Q2: Yes, see below.

Q3: You don't need to specify content-type anymore, however you should always specify the encoding (see below). In reality, though, you can use either one, so I would just stick with the short version. See this SO question for more info.

Q4: That's a difficult question to answer because it really depends on the browser / version. However, it's a moot point since the lang attribute should really be moved into the html tag (again, see below).

Below is what I consider the bare minimum a proper web page should include, (sans the comments):

<!DOCTYPE html>
<html lang="en"> <!-- use whatever language code is appropriate here -->
<head>
    <meta charset="utf-8"> <!-- utf-8 is universally the best encoding option -->
    <title>My Cool Website</title>
</head>
<body>
</body>
</html>
Community
  • 1
  • 1
Moses
  • 9,033
  • 5
  • 44
  • 67