Introduction
Good morning, students! Today, we will learn how to create and save an HTML document. HTML stands for HyperText Markup Language and is the standard language used to create web pages. We’ll go through the steps of creating a basic HTML document and saving it so it can be viewed in a web browser.
Step-by-Step Guide
- Choose a Text Editor:
- A text editor is a program used to write and edit plain text. Examples include Notepad (Windows), TextEdit (Mac), and more advanced editors like Sublime Text, Visual Studio Code, or Atom.
- For beginners, we will use Notepad on Windows or TextEdit on Mac.
- Open the Text Editor:
- Windows: Click on the Start menu, type “Notepad” in the search bar, and open Notepad.
- Mac: Open Finder, go to Applications, find and open TextEdit. Make sure to switch to plain text mode by selecting “Format” > “Make Plain Text”.
- Write the HTML Code:
- Every HTML document starts with a doctype declaration and an HTML tag. The basic structure includes
<html>
,<head>
, and<body>
tags. - Here’s a simple example:
- Every HTML document starts with a doctype declaration and an HTML tag. The basic structure includes
<!DOCTYPE html>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<h1>Welcome to My First HTML Page of Tutorialnexa</h1>
<p>This is a paragraph of text.</p>
</body>
</html>
OUTPUT :
My First HTML Page
Welcome to My First HTML Page Welcome to My First HTML Page of Tutorialnexa
This is a paragraph of text.
Save the HTML Document:
- After writing your HTML code, you need to save the file with an
.html
extension. - Windows:
- Click on “File” in the menu bar.
- Select “Save As”.
- Choose the location where you want to save the file.
- In the “File name” field, type a name for your file followed by
.html
(e.g.,index.html
). - In the “Save as type” dropdown, select “All Files”.
- Click “Save”.
- Mac:
- Click on “File” in the menu bar.
- Select “Save”.
- Choose the location where you want to save the file.
- In the “Save As” field, type a name for your file followed by
.html
(e.g.,index.html
). - Ensure the “If no extension is provided, use .txt” option is unchecked.
- Click “Save”.
Open the HTML Document in a Web Browser:
- Navigate to the location where you saved your HTML file.
- Double-click on the file, or right-click and choose “Open with” and select your web browser (e.g., Chrome, Firefox, Edge).
- Your web page should now be displayed in the browser.
Summary
Creating and saving an HTML document involves choosing a text editor, writing the basic HTML structure, and saving the file with an .html
extension. You can then view your web page in a web browser.
To create and save an HTML document:
1. Open a text editor (e.g., Notepad, TextEdit).
2. Write the basic HTML code:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
3. Save the file with a .html extension (e.g., index.html).
4. Open the saved file in a web browser to view the web page.