How to Create Basic Webpage

Written by Admin Updated 15 min read

Introduction

HTML, or HyperText Markup Language, is the standard markup language used to create webpages.

In this tutorial, you will learn how to create a basic HTML website from scratch. You will create an HTML file, add content, and open the webpage in a browser.

What You Will Learn

What HTML is
How to create an HTML file
Basic HTML document structure
How to add headings and paragraphs
How to add links and images

What is HTML?

HTML stands for HyperText Markup Language. It defines the structure and content of a webpage.

HTML is used for structure, CSS is used for presentation, and JavaScript is used to add interactivity.

What You Need

  • A computer
  • A text editor such as Notepad or VS Code
  • A web browser such as Chrome, Firefox, or Edge

🚀 Create Your First HTML Webpage

Step 1: Create an HTML File

Follow these simple steps to create and run your very first HTML webpage.

Steps to follow:
  1. Open a Text Editor

    You can use Notepad, Visual Studio Code (VS Code), Sublime Text, Notepad++, or any code editor of your choice.

Step 2: Write Your First HTML Code

Steps to follow:
  1. Create a New File

    Save the file with the .html extension. For example: index.html

  2. Write the HTML Code

    Copy and paste the following HTML code into your editor.

Add the following code to your index.html file:

HTML Editor
Live Output

Step 3: Open the Website

Displaying the webpage
  1. Save the File

    Ensure the filename is index.html.

  2. Open the File in a Browser
    • Double-click the HTML file, or right-click and choose Open With → Chrome, Firefox, Edge, or any browser.
    • Your webpage will now be displayed.
  3. Modify and Refresh

    Make changes to the HTML file, save it, and refresh the browser to see the updated webpage.

📘 Basic HTML Structure Explained

<!DOCTYPE html>

Declares that the document uses HTML5.

<html>

The root element that contains the complete webpage.

<head>

Stores metadata including the page title, character encoding, CSS links, and scripts.

<title>

Displays the page title in the browser tab.

<body>

Contains all visible webpage content.

<h1>

Defines the main heading.

<p>

Defines a paragraph.

Congratulations! You have successfully created your first HTML webpage. Continue experimenting by adding headings, images, links, tables, and lists to build more interesting webpages.

Step 4: Try Mini Project

HTML Editor

Common Problems

Check that the file is saved as index.html, not index.html.txt.

Save the HTML file and refresh your browser.

Check the image filename and path in the src attribute.

What's Next?

You have created your first webpage. Now let's understand how HTML structures a webpage and how CSS can be used to style that structure.

Frequently Asked Questions

HTML is the standard markup language used to structure webpages.

Yes. You can create and view basic HTML files locally without an internet connection.

HTML is a markup language rather than a programming language. It defines the structure of webpage content.

HTML (HyperText Markup Language) is the standard markup language used to create the structure of web pages. It uses a series of tags (e.g., <p>, <h1>, <a>) to tell the web browser how to format and display content such as text, images, links, and layout elements.

  • Tag: The opening or closing marker wrapped in angle brackets (e.g., <p> is an opening tag, </p> is a closing tag).
  • Element: The complete unit consisting of the opening tag, the content inside, and the closing tag (e.g., <p>Hello World</p>).
  • Attribute: Extra information provided inside the opening tag to configure or modify the element (e.g., src="image.jpg" in <img src="image.jpg">).

Void elements are HTML tags that do not contain any content and therefore do not require a closing tag.

Common Examples: <img>, <br> (line break), <hr> (horizontal rule), <input>, and <meta>.

<!DOCTYPE html> is an instruction sent to the web browser that specifies the document type and HTML version (HTML5). It must be the very first line of an HTML document to ensure the browser renders the page in standard mode rather than "quirks mode."

  • <head>: Contains metadata, page titles, character encodings, links to external CSS stylesheets, and scripts. Nothing inside <head> is directly displayed on the main webpage canvas (except the <title> shown on the browser tab).
  • <body>: Contains all the visible content of the webpage, including headings, paragraphs, images, links, tables, and structural containers.

It sets the character encoding for the HTML document to UTF-8, which supports almost all human languages, symbols, and special characters, preventing text rendering errors across different devices and browsers.

  • Block-level Elements: Always start on a new line and take up the full width available (100% of their parent container). Examples: <div>, <p>, <h1>–<h6>, <ul>, <li>, <form>.
  • Inline Elements: Do not start on a new line and only take up as much width as their content requires. Examples: <span>, <a>, <img>, <b>, <i>, <strong>.

Both are non-semantic containers used to group elements for styling or scripting:
  • <div> is a block-level container used for larger layout sections.
  • <span> is an inline container used to wrap small sections of text or media on the same line.

  • Absolute Path: The full URL to an asset on the internet (e.g., https://example.com/images/logo.png).
  • Relative Path: A path relative to the location of the current HTML file (e.g., ./images/logo.png or ../css/style.css).

The alt (alternative text) attribute provides a text description of an image. It is critical for:
  1. Accessibility: Screen readers read the alt text aloud to visually impaired users.
  2. SEO: Search engines use alt text to understand image content.
  3. Fallback: It displays on screen if the image file fails to load.

Semantic HTML means using HTML tags that clearly describe their meaning to both the browser and the developer (e.g., <header>, <nav>, <main>, <article>, <section>, <footer>) rather than generic <div> tags.

Benefits include:
  • Better search engine optimization (SEO).
  • Improved web accessibility (a11y) for screen reader tools.
  • Cleaner, more readable, and easier-to-maintain code structure.

  • <strong> and <em> (Semantic): Indicate semantic emphasis or importance. Screen readers alter their vocal inflection for these tags.
  • <b> and <i> (Stylistic): Merely change the visual appearance (bold or italic) without conveying extra meaning or importance.

  • <ol> (Ordered List): Renders items in a sequential or numbered order (1, 2, 3...).
  • <ul> (Unordered List): Renders items with bullet points without chronological sequence.
  • <dl> (Description List): Used for terms (<dt>) and descriptions (<dd>), ideal for glossaries, metadata, or key-value pairs.

HTML <form> elements send user input via form controls (like <input>, <select>, <textarea>) using the action attribute (destination URL) and method attribute:
  • GET: Appends form data to the URL as query parameters (suitable for non-sensitive data/searches).
  • POST: Sends form data inside the HTTP request body (suitable for sensitive data, logins, or file uploads).