How to create a simple webpage using HTML

What is a webpage?

A webpage is a document composed in HTML (Hypertext Markup Language) and can be accessed through a web browser.

HTML is the basic building block of a webpage. It is the standard markup language used to create and design documents on the World Wide Web.

Example of Creating a Simple webpage

1. Create an HTML Document

Create an HTML file and open it in your preferred code editor.

2. Declaration of Document Type and Adding HTML Element

Add <!DOCTYPE html> at the beginning of the HTML document. This declaration is the first component of an HTML document. It declares the document type and version (HTML5).

Add HTML element <html lang="en"> </html>. The <html lang="en"> is the opening tag for the HTML element, indicating the beginning of the HTML document. The lang attribute specifies the language of the document; in this case it is English.

The </html> is the closing tag for the HTML element, indicating the end of the HTML document.

Example of Adding Document Type and HTML Element



3. Adding Head Element

Inside <html> element, add HTML <head> element as shown in the following code. Inside head element, title, meta, script, link, and style elements are added.

Example of Adding Head Element



4. Adding Body Element

Below <head> element, add HTML <body> element as shown in the following code.

HTML <body> element includes everything that is displayed on the webpage, such as text, images, links, forms, and other elements.

Add a <h4> and a <p> element inside the <body> element with the text as shown in the following example.

Example of Adding Body Element


Output of the above example

Simple webpage

This is a simple webpage created using HTML.

Live Code Playground

In the following HTML code editor, you can practice the above code by updating or adding more HTML elements. Click on the 'Run Code' button to render the code; the rendered page will be displayed in the following HTML Code Output frame. Practice until you become comfortable and proficient with your code.

HTML logo HTML Online Editor
HTML Code Output