Learning path · Level 1 · Tutorial 2

Create and Inspect a Local HTML Page

Create a complete HTML document in your own editor, open it in a browser, and inspect how its elements relate to the displayed page.

  • Level: Beginner
  • Duration: 17 min
  • 8 steps
Start tutorial Back to the path
Create and Inspect a Local HTML Page

What you will go through

  1. Prepare Your Local HTML File Create a local project folder and save an empty UTF-8 plain-text HTML file with the exact required filename. 2 min
  2. Read and Write Basic HTML Learn to read HTML elements as tags, text content, attributes, and nested containers before building the complete document. 2 min
  3. Build the Complete Document Build, save, and check the structure of a complete local HTML document. 3 min
  4. Open and Check the Page Open your saved local HTML file in a browser and compare its source content with the displayed tab and page body. 2 min
  5. Practice Edit, Save, and Refresh Make a saved change to the second paragraph and refresh the local page to confirm it in the browser. 2 min
  6. Locate a Paragraph in the Inspector Use browser developer tools to select a visible paragraph and locate its corresponding element in the current DOM tree. 2 min
  7. Test a Temporary Inspector Change Test a text change in the browser inspector and distinguish the current DOM from the saved source file. 2 min
  8. Complete and Verify Your Local Page Finalize your local HTML page, verify that its saved change survives a refresh, and connect the rendered paragraph to its DOM element. 2 min

What you will learn

  • Create a project folder and save a plain-text HTML document with the correct file extension.
  • Write a document containing its language, character encoding, page title, and visible paragraphs.
  • Apply the edit-save-refresh workflow to confirm a source change in the browser.
  • Locate a displayed element in the browser inspector and distinguish temporary inspection edits from saved source changes.

Before you start

  • How Browsers Display Web Pages

Step 1 of 8

Prepare Your Local HTML File

Create a local project folder and save an empty UTF-8 plain-text HTML file with the exact required filename.

Set up the workspace

Your local workspace

Your local workspace has three parts on your own computer: a project folder to hold the file, a plain-text editor or code editor to write it, and a browser to display it later. No online workspace or server is needed for this tutorial.

A diagram showing a project folder with a document, a plain-text editor, and a browser as parts of a local workspace.

The folder stores the source file; the editor changes it; the browser will display it.

Create the project file

Create and save the empty file

Use your computer's file manager to choose any location you can find again. Create one folder named first-page.

Open a plain-text editor or code editor. Create a new empty document and save it inside that folder with the exact name index.html. Its project-relative location is first-page/index.html.

Save the file using UTF-8 encoding. Keep it empty for now; you will add the page content in the next step.

Tip

Plain text matters

Do not use a rich-text document editor. A rich-text file can store formatting and may add a different extension, so it is not the plain-text source file a browser expects here.

Check the extension

Check the complete filename after saving. If your file manager hides extensions, turn on filename-extension visibility before continuing.

Only one of these names is the required plain-text HTML source file.
Filename shownWhat it means
index.htmlRequired source filename
index.html.txtText file with an extra extension
index.html.rtfRich-text document

Quick filename check

Spot the correct filename

Which filename is correctly named for the empty source file inside the first-page folder?

Create and verify

Verify your local file

Now use your file manager and editor to create the folder and save the empty file. Then verify its complete name, including the extension. In your own words, report the project-relative location and the two checks that confirm you saved the required kind of file.

Write at least 80 characters (0/80).

Step 2 of 8

Read and Write Basic HTML

Learn to read HTML elements as tags, text content, attributes, and nested containers before building the complete document.

Identify the parts of an element

Elements, tags, and content

HTML uses elements to mark up content. A typical element has three parts:

  1. An opening tag: <p>
  2. Text content: the words between the tags
  3. A closing tag: </p>

The p element marks a paragraph. Its text is visible when a browser displays the page. A tag is only one part of an element; the complete element includes its content and, for this example, its closing tag.

Paragraph example

A complete paragraph element

html
<p>Hello from my local page.</p>

The parts of a paragraph

Diagram showing an opening p tag, visible text content, and a closing p tag as the three parts of a paragraph element.

The opening tag starts the paragraph, the text is its content, and the closing tag ends it.

Read containment in markup

Attributes and nesting

An attribute adds information in an opening tag. It has a name and a value. In this tutorial, lang="en" belongs in the opening html tag and identifies the document language as English.

Elements can contain other elements. This is called nesting. In the fragment below, html contains body, and body contains the paragraph. Close the inner paragraph before closing its body container.

Read the nesting from outside to inside

This is a nested fragment, not the complete document you will build next.

html
<html lang="en">
  <body>
    <p>Hello from my local page.</p>
  </body>
</html>

See the containment

Diagram aligning indented html, body, and p markup with nested containers, showing that the p element closes before body and html.

The paragraph sits inside body, which sits inside html. Closing moves from the innermost element outward.

Tip

Indentation is a reading aid

The two spaces make containment easier to scan: the paragraph is indented farther because it sits inside body. However, indentation does not create the relationship. The opening and closing tags determine what is nested inside what.

Check the vocabulary

Classify HTML parts

Match each piece of markup to its role.

Tap an item and then its matching pair.

Apply the structure

Complete a correctly nested paragraph

Complete the nested HTML fragment. Use the language attribute, the paragraph opening tag, and its matching closing tag.

html
<html >
  <body>
    <>Hello from my local page.
  </body>
</html>

Step 3 of 8

Build the Complete Document

Build, save, and check the structure of a complete local HTML document.

Recognize the document areas

Map the document

A complete HTML source file begins with <!DOCTYPE html>. This is a declaration, not an HTML element. It tells the browser to use standards-mode rendering.

The html element contains the document. Inside it, head holds document information and body holds the content displayed on the rendered page.

Document information and page content

Diagram showing a declaration before an outer HTML document, with an upper information area connected to a browser tab and a lower area containing two displayed paragraphs.

Document information belongs in head; visible paragraphs belong in body.

Information versus visible content

The title text labels the browser tab, not a paragraph on the page. The meta charset declaration identifies the character encoding. Because you save this file as UTF-8, use charset="UTF-8".

meta is a void element: it has no child content and no closing tag.

Assemble and save the source file

Complete source for index.html

Replace the empty contents of first-page/index.html with this complete document. Keep the indentation, save the source file using UTF-8 encoding, and save it before opening it in a browser in the next step.

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>My First Local Page</title>
  </head>
  <body>
    <p>Hello from my local page.</p>
    <p>I am learning HTML.</p>
  </body>
</html>
Expected output
Browser tab: My First Local Page

Rendered page:
Hello from my local page.

I am learning HTML.

The browser's font and paragraph spacing can vary. Confirm the tab title and the two paragraph texts, in this order.

Check before saving

Read the structure from outside inward: the html element contains head and body. The head contains the character encoding followed by the tab title. The two p elements belong in body, so their text can appear on the rendered page.

Tip

Save the source file

Use the exact project-relative location first-page/index.html. Confirm that the filename ends in .html, not .html.txt.

Practice the complete structure

Place the document parts

Complete the missing document parts in their correct positions.

Step 4 of 8

Open and Check the Page

Open your saved local HTML file in a browser and compare its source content with the displayed tab and page body.

Open the saved document

Open the local file

Open your saved source file in a browser. In your file manager, find first-page/index.html, then choose Open with and select a browser. Alternatively, use your browser’s file-opening command and select that file.

The browser should display the rendered page. In its address bar, confirm that the local file address ends with first-page/index.html. The beginning of the address can differ because you chose where to store the first-page folder.

A project folder containing an HTML file is opened in a browser as a local file.

Open the saved source file from your computer, then confirm the filename in the browser’s local file address.

Verify the tab and page body

Check the expected result

Check two areas of the browser:

  • The browser tab should read My First Local Page.
  • The page body should show Hello from my local page. followed by I am learning HTML.

This is an unstyled page, so its font and the space between paragraphs can vary by browser and operating system. What matters is the title and the paragraph text.

If the result is unexpected, first check that first-page/index.html was saved, that its full filename ends in .html rather than .html.txt, and that you opened it in a browser rather than in your editor.

A browser tab area and two unstyled paragraphs in the page body are highlighted as separate places to check.

The title is shown in the browser tab; paragraph elements are shown in the rendered page body.

Match each item to its result

Connect source to result

Match each source item to its browser result.

Tap an item and then its matching pair.

Check your local page

Report what you observe

Look at your own browser window. Report the tab title, then report the two visible paragraphs in their displayed order.

Write at least 50 characters (0/50).

Step 5 of 8

Practice Edit, Save, and Refresh

Make a saved change to the second paragraph and refresh the local page to confirm it in the browser.

Connect the editor and browser

From source change to browser result

A source change becomes visible through a short workflow:

  1. Edit the source file in your editor.
  2. Save first-page/index.html.
  3. Refresh the browser tab that opened that file.

Editing changes what is currently in the editor. Saving writes that change to the source file on disk. Refreshing asks the browser to display the saved version again.

This directly opened local page does not automatically update just because you typed or saved.

The edit-save-refresh workflow

A diagram showing a source paragraph edited in an editor, saved to a file, and displayed after a browser refresh.

Edit the source file, save it, then refresh the browser to see the saved change.

Edit, save, then refresh

Make one saved source change

In your editor, open first-page/index.html. Change only the text inside the second paragraph. Keep the first paragraph and all tags unchanged.

Then save the file using UTF-8 encoding. Return to the browser tab where this local file is open and use the browser refresh control or its refresh shortcut.

Body after the edit

Replace the second paragraph in the body with this version, then save the file:

html
<body>
  <p>Hello from my local page.</p>
  <p>I can edit, save, and refresh.</p>
</body>
Expected output
Hello from my local page.

I can edit, save, and refresh.

This is the visible result after you apply this body fragment to the existing document, save `first-page/index.html`, and refresh the browser. Default spacing can vary by browser.

Tip

When the change seems missing

If the browser does not show the new second paragraph, pause before changing more code. Check three things: the editor shows that the file is saved, the browser opened first-page/index.html, and you refreshed that browser tab after saving.

Check the source edit

Complete the changed paragraph

Complete the second paragraph that belongs in the saved source file for this practice.

html
<p></p>

Verify the workflow

Order the workflow

Put the workflow actions in the order that confirms a persistent local source change.

  1. Edit the second paragraph in the source file
  2. Save index.html
  3. Refresh the browser and verify the paragraph

Report your result

After you perform the workflow on your own computer, write one or two sentences: identify the paragraph you edited and report what the browser showed after you saved and refreshed.

Write at least 40 characters (0/40).

Step 6 of 8

Locate a Paragraph in the Inspector

Use browser developer tools to select a visible paragraph and locate its corresponding element in the current DOM tree.

Select the paragraph

Inspect the displayed paragraph

You have already opened the saved workflow-practice page. Now connect what you see on the rendered page to its element in the browser.

Right-click the visible second paragraph and choose Inspect. Some browsers call this command Inspect Element. This opens the browser’s developer tools and selects the related item in the page structure.

In Chrome or Edge, use the Elements panel. In Firefox, use the Inspector panel.

From page highlight to DOM node

A highlighted second paragraph on a browser page corresponds to a highlighted p node inside body in the developer tools tree.

Inspect links the highlighted rendered paragraph to its current node in the developer tools tree.

Tip

The selection highlight is a useful confirmation: the node selected in the panel corresponds to the part of the rendered page you chose.

Trace parent and child elements

Read the current DOM tree

The Elements or Inspector panel shows the DOM tree: the browser’s current document structure. It is not the source file open in your editor, even though the structure may look similar.

If you cannot see the selected paragraph immediately, expand its parent nodes with their disclosure arrows. The selected p element is a child of body; both paragraphs are children of that same body element.

The paragraph’s place in the tree

A simplified view of the structure you should find

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>My First Local Page</title>
  </head>
  <body>
    <p>Hello from my local page.</p>
    <p>I can edit, save, and refresh.</p>
  </body>
</html>

Tip

Indentation helps you read containment: body contains the two p elements. In the inspector, selecting a node highlights its related rendered content.

Check the correspondence

Match the highlighted content

A page highlight surrounds the second visible paragraph. Match each page or tree cue to its corresponding DOM description.

Tap an item and then its matching pair.

Verify on your page

Report what you inspected

On your own local page, use Inspect on the second visible paragraph. In one sentence, report the selected element name, its displayed text, and its parent element.

Write at least 25 characters (0/25).

Step 7 of 8

Test a Temporary Inspector Change

Test a text change in the browser inspector and distinguish the current DOM from the saved source file.

Change the paragraph in the inspector

Edit the current DOM

In the Elements panel (Chrome or Edge) or Inspector panel (Firefox), keep the second <p> element selected. Edit its text content—not its styles.

Double-click the paragraph text in the DOM tree, replace it with This change is temporary., and press Enter. The rendered page should update immediately.

You changed the browser’s current DOM tree. You did not edit or save first-page/index.html.

A code editor remains unchanged while a selected paragraph in the developer tools DOM tree and the rendered browser page change together.

An inspector text edit changes the current DOM tree and the rendered page, while the saved source file remains unchanged.

Compare the source file and the DOM

Two places, two kinds of change

Compare where each kind of change happens. At this point, the saved second paragraph in first-page/index.html is still I can edit, save, and refresh., even though the browser currently shows different text.

Source edit versus inspector edit

An ordinary inspector edit is useful for testing the current page, but it is not a way to save work to your file.

Only a change made and saved in the source file can remain after a refresh.
QuestionSource editInspector edit
Where is it made?In index.html in the editorIn the current DOM tree
Does saving matter?Yes; save the source fileNo source file is saved
What changes now?The file on diskThe rendered page immediately
What happens after refresh?Saved change is rebuilt into the pageTemporary change is discarded

Predict, then refresh

Test the refresh

Keep the editor open and do not change or save its source. In the browser, use its refresh command after making the inspector edit. Then compare the rendered second paragraph with the paragraph still written in the editor.

Predict the result

You change only the second paragraph in the inspector and do not edit the source file. After refreshing the browser, This change is temporary. will still be displayed.

Observe and explain

Explain the temporary change

Complete the practical check from the previous screen. Then, in 2–4 sentences, describe what you saw before and after the refresh. Explain why the saved paragraph returned and state where you must make a change for it to be permanent.

Write at least 120 characters (0/120).

Step 8 of 8

Complete and Verify Your Local Page

Finalize your local HTML page, verify that its saved change survives a refresh, and connect the rendered paragraph to its DOM element.

Save the final source version

Make the final saved change

Work in your saved source file, first-page/index.html—not in developer tools. Keep the first paragraph unchanged. Replace only the text inside the second p element with the final text below, then save the file using UTF-8 encoding.

first-page/index.html

Your final saved source should match this document:

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>My First Local Page</title>
  </head>
  <body>
    <p>Hello from my local page.</p>
    <p>I can create and inspect HTML.</p>
  </body>
</html>
Expected output
Browser tab:
My First Local Page

Rendered page:
Hello from my local page.
I can create and inspect HTML.

Browser fonts and paragraph spacing can vary. The labels below identify the tab and page content you should verify.

Run the final checks

Verify in the browser and DOM tree

After saving, return to the browser and refresh the local page. Then use Inspect on the second displayed paragraph to open developer tools. In Chrome or Edge, find it in Elements; in Firefox, find it in Inspector. Refresh once more after inspecting: the final text should still be present because it came from the saved source file.

From saved source to rendered page and DOM tree

Diagram connecting a saved HTML source file, its unstyled rendered browser page, and the highlighted matching paragraph in the browser DOM tree.

Save updates the source file; refresh rebuilds the rendered page from that saved file. The inspector shows the current DOM tree.

Final verification checklist

Use this checklist before your final report.

Check each item on your own computer.
CheckWhat to confirm
Filenamefirst-page/index.html, with .html rather than .txt
Document startDOCTYPE followed by html with lang="en"
Head informationUTF-8 meta declaration and the page title
Visible contentTwo paragraphs in the body
Browser tabMatches the title in the source
InspectorThe second paragraph's p element is selected in the DOM tree
PersistenceThe final second paragraph remains after another refresh

Confirm the final paragraph

Complete the final paragraph

Complete the second paragraph in the final saved source.

html
<p></p>

Apply and complete

Final local-page verification

On your computer, make sure the final source version is saved. Refresh the browser, inspect the second paragraph, and refresh once more. Then report all five results: the tab title, the final second-paragraph text, the selected element in the DOM tree, what happened after the second refresh, and where a lasting change must be saved.

Write at least 100 characters (0/100).

Tutorial complete

Congratulations! You completed: Create and Inspect a Local HTML Page

You can now create a local HTML source file, display it in a browser, save and verify an update, and inspect how a rendered paragraph corresponds to an element in the current DOM tree.

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate