- HTML Introduction
- What is HTML?
- A Simple HTML Document
- Example
- My First Heading
- Example Explained
- What is an HTML Element?
- Web Browsers
- HTML Page Structure
- This is a heading
- HTML History
- What is HTML?
- What is HTML?
- Example of HTML
- How HTML works?
- How to create and run an HTML file?
- HTML Features
- Cons of HTML
- Table of Contents
HTML Introduction
HTML is the standard markup language for creating Web pages.
What is HTML?
- HTML stands for Hyper Text Markup Language
- HTML is the standard markup language for creating Web pages
- HTML describes the structure of a Web page
- HTML consists of a series of elements
- HTML elements tell the browser how to display the content
- HTML elements label pieces of content such as «this is a heading», «this is a paragraph», «this is a link», etc.
A Simple HTML Document
Example
My First Heading
My first paragraph.
Example Explained
- The declaration defines that this document is an HTML5 document
- The element is the root element of an HTML page
- The element contains meta information about the HTML page
- The element specifies a title for the HTML page (which is shown in the browser’s title bar or in the page’s tab)
- The element defines the document’s body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
- The element defines a large heading
- The
element defines a paragraph
What is an HTML Element?
An HTML element is defined by a start tag, some content, and an end tag:
The HTML element is everything from the start tag to the end tag:
Note: Some HTML elements have no content (like the
element). These elements are called empty elements. Empty elements do not have an end tag!
Web Browsers
The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML documents and display them correctly.
A browser does not display the HTML tags, but uses them to determine how to display the document:
HTML Page Structure
Below is a visualization of an HTML page structure:
This is a heading
This is another paragraph.
Note: The content inside the section will be displayed in a browser. The content inside the element will be shown in the browser’s title bar or in the page’s tab.
HTML History
Since the early days of the World Wide Web, there have been many versions of HTML:
Year | Version |
---|---|
1989 | Tim Berners-Lee invented www |
1991 | Tim Berners-Lee invented HTML |
1993 | Dave Raggett drafted HTML+ |
1995 | HTML Working Group defined HTML 2.0 |
1997 | W3C Recommendation: HTML 3.2 |
1999 | W3C Recommendation: HTML 4.01 |
2000 | W3C Recommendation: XHTML 1.0 |
2008 | WHATWG HTML5 First Public Draft |
2012 | WHATWG HTML5 Living Standard |
2014 | W3C Recommendation: HTML5 |
2016 | W3C Candidate Recommendation: HTML 5.1 |
2017 | W3C Recommendation: HTML5.1 2nd Edition |
2017 | W3C Recommendation: HTML5.2 |
This tutorial follows the latest HTML5 standard.
What is HTML?
HTML (HyperText Markup Language) is used to structure and format the content of websites on the World Wide Web. Web Developers use it to create a skeleton of modern websites and web apps.
What is HTML?
In simple words, HTML is the primary building block to create and structure website content.
Let’s see what HyperText Markup Language means.
- HyperText
HyperText is a way of organizing text that allows the reader to easily navigate and access related information. It takes the reader to a different part of the same web page, or to a different web page altogether. - Markup language
A markup language is a computer language that is used to add structure and formatting to a text document. Markup languages use a system of tags to define the structure and content of a document. These tags are interpreted by a program or application to display the document in a specific way.
Example of HTML
Let’s see a simple example of HTML.
HTML Tutorial
You'll learn about HTML.
Browser output
- — defines that this document is an HTML document
- -root element of an HTML page which encloses all other elements in the HTML page
- — contains information about the page, such as the title and metadata
- — specifies a title for the HTML page which is shown in the browser’s title bar
- — defines the main content of the page and is a container for all the visible contents, such as headings, paragraphs, lists, etc
- — defines a heading
-
— defines a paragraph of HTML document
How HTML works?
HTML works by defining the structure and content of a web page using a series of tags like ,
, etc. Each tag has a meaning and can be used to define the purpose of the content it encloses. For example,
Programiz
Learn to Code for Free
Learn to code with our beginner-friendly tutorials and examples. Read interactive tutorials, and write and test your code to learn programming.
Browser output
As you can see, a web browser reads HTML tags and displays them on the browser by interpreting their meaning. In the above code:
- tag — displays the content inside it as a heading
-
tag — displays the content inside it as a paragraph
- tag — displays contents inside it at the center of the page
How to create and run an HTML file?
You will need a text editor and a web browser to create and run an HTML file on your computer. You can follow the following steps to create and run an HTML file on your device.
- Open a text editor. There are many text editors available, such as Notepad (on Windows) or TextEdit (on macOS).
- You can now start writing HTML code in your text editor. Here’s a sample code you can type:
- Save the file as index.html (or any other name with the .html extension) in your desired location.
- Open the HTML file in a web browser. You can do this by double-clicking the HTML file in the location where you saved it, or right click on your HTML file and choosing open.
- The HTML file will be displayed in the web browser, and you can view the content of the file.
Alternatively, you can use an Online HTML compiler.
HTML Features
HTML is a text-based language used to create web pages. It has several features that make it a powerful and widely used language for creating web pages. Some of these features include:
- HTML is a standard language used for creating and structuring web pages. It allows for the organization of content using elements such as headings, paragraphs, lists, and tables.
- It supports a wide range of media types, including text, images, audio, and video, which makes web pages more engaging and interactive.
- HTML is a flexible language that can be used with other technologies, such as CSS and JavaScript, to add additional features and functionality to a web page
- Since HTML is compatible with all browsers, web pages created in HTML are displayed across a variety of platforms and devices.
- Furthermore, it is an open and standardized language, which is constantly being updated and improved by a community of developers and experts
Cons of HTML
Here are some of the cons of using HTML:
- text-based language, which can make it difficult to read and write
- may not be powerful enough to handle some of the more complex features found in modern web pages
- can be challenging to maintain and update over time