1Short HTML Introduction
- Full form of HTML is Hyper Text Markup Language.
- It informs the browser about the type of content and its structure.
- Browsers read HTML to understand and render the web page.
- HTML element starts with an opening tag and ends with a closing tag.
- Browsers never display HTML tags on the screen.
2HTML and XHTML
HTML is parsed easily by the browsers, neglecting minor errors. On the other hand, XHTML is a lot strict than HTML, even a small omission can give an error. XHTML is based on XML and thus requires the code to be well-formed.
3So, what is XML?
XML stands for Extensible Markup Language. The programmer can write his own custom tags. (Remember HTML has predefined tags, but XML doesn’t). XML is self-descriptive. XML is not a substitute for HTML. It just stores the content in a way that can be understood by the human as well as the machine.
- HTML tags normally come in pairs like <p> This is a paragraph </p> for marking a paragraph.
- The first tag in a pair is the opening tag, the second tag is the closing tag.
- The closing tag is written like the opening tag, but with a forward slash inserted before the tag name.
- Some HTML tags are alone and do not require the closing tag (called empty tags, discussed later).
5The !DOCTYPE Declaration
- The <!DOCTYPE> is used to inform the browser about the content type so that the browser can display the file correctly.
- It should always be written on the very first line of the document before any other tag.
- It is not case sensitive but should always include exclamation before it.
- If you want to tell the browser that your document type is HTML then write it as <!DOCTYPE html>