HTML Markup Language
HTML, an acronym for Hyper Text Markup Language, is the main markup language for creating websites. It consists of series of codes, which are used to structure texts, images, and other content to be displayed in a browser.
HTML was first developed by British physicist Tim Berners-Lee in 1990. Since then, there have been many versions of HTML.
HTML building blocks
The main building blocks in HTML are elements, tags and attributes.
HTML document consists of HTML elements defined using HTML tags.
HTML tags are used to structure website content (texts, hyperlinks, images, media, etc). Tags are not displayed in the browsers, they only “instruct” browsers how to show the content of the web page.
There are over 100 tags in HTML, and you can find most of them in our tutorial.
HTML tags are written in angle brackets e.g. <html>
Most of HTML tags come in pairs like <p> </p>. The first tag in a pair is called the start (opening) tag, and the second tag is the end (closing) tag. The information is written between opening and closing tags.
However, there are unpaired tags, which only have opening tag (for example <img/>).
HTML attributes can be added to tags to provide additional information about it.
Structure of HTML Document
- <!DOCTYPE html > declaration defines the type of the document.
- The <html> element describes the web page; all the content on the page is written between <html> </html>.
- The <head> element contains metadata (data about the HTML document), character set, document title, styles, etc. This data is not visible to users.
- The <title> element is the title of the website in the browser tab when the page is loaded. The title is written between<title></title>tags.
- The <body> element is the content of the webpage (texts, images, videos, etc). The content is written between <body></body>.
- The heading elements contain different types of headings. There are six heading levels -<h1>-<h6>
- The <p> element contains paragraphs of the text. The content is written between <p> and</p> tags.
How to write <!DOCTYPE html> in other versions
As we already mentioned, we use the <!DOCTYPE html> declaration to display the web page correctly. For the browser to display an HTML page 100% correctly it should know the HTML type and version that is used.
|How to write <!DOCTYPE html> in different versions|
|HTML 4.01||<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd";>|
|XHTML 1.0||<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">|
To start writing HTML code for your website, you will need an HTML editor. We will speak about HTML editors in our next chapter.