How can I tell if the following Web page source code is XHTML, HTML or XML?

StackOverflow https://stackoverflow.com/questions/22461463

  •  16-06-2023
  •  | 
  •  

Вопрос

I am working with this Web Page for improving my programming skills:

http://www.studenti.ict.uniba.it/esse3/ListaAppelliOfferta.do

If you take a look at its source code, you can see HTML peculiar tags like

<head> <body> <title>

The question is: I am quite sure this page is not in XML, so is it simple HTML or XHTML?

According to my knowledge those two are quite similar.

How can I tell which of the two it is? If I must choose I'd say simple HTML (5 or 4) but I am not 100% sure!

Это было полезно?

Решение

Look for a Doctype declaration at the very beginning of the document.

If it is XHTML, the doctype will look like this:

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

If it is HTML5, it will look like this:

<!DOCTYPE html>

See the W3 Spec for information on Doctype. More information here at the Mozilla Developer Network, too.

The Website you linked has <!DOCTYPE html> declared, which instructs the browser to interpret the document as HTML5 markup.

Другие советы

The <!DOCTYPE html> declaration indicates that it is HTML5. Of course, it might not actually be HMTL5, but it's claiming that it is. The only way to be sure is to run it through an HTML5 validator.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top