Popular Searches
Popular Course Categories
Popular Courses

Page structure

26 mins HTML5 & Semantic Markup

Page structure in React JS

Course: React JS Training

Topic: Page structure

Course Link: React JS Training

Demo Link: Register for a Course Demo


1. Why Page Structure Matters

Every web page you have ever visited — a news site, a shopping site, a learning portal — is built on the same foundation: an HTML document with a clear structure. Before you can style a page with CSS, make it interactive with JavaScript, or build components in React, you need to understand how a raw HTML page is put together. This is the very first brick in the wall.

Structure matters for three practical reasons. First, the browser reads your HTML from top to bottom and decides how to display it, so a well-organised document is easier for the browser to interpret correctly. Second, a predictable structure makes your own work easier: when you return to a file after a week, a clean layout of head, header, main and footer tells you instantly where things are. Third, search engines and screen readers rely on structure to understand your page, which affects both your visibility in search results and the experience of users with disabilities.

For a React developer, this knowledge is not optional. When React renders on the server and sends pre-rendered HTML to the browser, that HTML still has to be a valid, well-structured document. The habits you build here — clear nesting, meaningful containers, one main landmark — carry directly into every React project you will write later.


2. What Is Page Structure?

In simple words, page structure is the skeleton of an HTML document: the fixed set of containers that hold everything else. Think of a printed newspaper. It has a masthead at the top, sections like sports and business in the middle, and publication details at the bottom. An HTML page follows the same idea — a defined top area for metadata, a visible area for content, and within that content, named regions for navigation, articles and supporting information.

More precisely, page structure has two levels:

  • Document level: the outer shell every HTML file must have — the document type declaration, the html element, the head and the body.
  • Content level: the regions inside the body — landmarks such as header, nav, main, aside and footer — that organise the visible content.

This sub-module covers both levels. Later pages in this module look at forms, tables, media and accessibility in depth; here we focus on how the whole page is assembled.


3. Key Terms You Will Meet

TermMeaning in plain words
elementA complete unit of HTML: an opening tag, content, and a closing tag, for example <p>Hello</p>.
tagThe marker written inside angle brackets, such as <main> and </main>, that labels the element.
attributeExtra information placed inside the opening tag, such as lang="en" or charset="UTF-8".
nestingPlacing elements inside other elements. The nesting order must be closed in reverse: the last opened tag is closed first.
metadataInformation about the page (title, character encoding, description) that lives in the head and is not shown as page content.
landmarkA structural region such as nav or main that browsers and screen readers can identify and jump to.
boilerplateThe standard starter code you copy into every new HTML file before adding your own content.
viewportThe visible area of the page in the browser window; controlled by a meta tag so pages scale correctly on phones.

4. The Syntax and Structure of an HTML5 Document

Every well-formed HTML5 page follows the same outer pattern. Here is the minimal skeleton, often called boilerplate:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Page title shown in the browser tab</title>
  </head>
  <body>
    <!-- All visible content goes here -->
  </body>
</html>

Read it line by line:

  1. <!DOCTYPE html> — a single declaration telling the browser "this is an HTML5 document". It is not an element and it has no closing tag.
  2. <html lang="en"> — the root element that wraps the entire document. The lang attribute declares the page language, which helps screen readers pronounce text correctly.
  3. <head> — the container for metadata: character encoding, viewport settings, the page title, links to stylesheets and scripts.
  4. <body> — the container for everything the visitor actually sees and interacts with.

Two rules keep this structure valid. Every element you open must be closed, and elements must be closed in the order they were opened. <head><title>...</title></head> is correct; closing head before title is not.


5. How the Browser Builds a Page, Step by Step

Understanding what happens after you save a file makes the structure feel less like rules to memorise and more like a process you control.

  1. Request: you open the file locally or the browser fetches it from a server.
  2. Parse: the browser reads the text from top to bottom, turning tags into a tree of objects called the DOM (Document Object Model).
  3. Metadata pass: while reading the head, the browser applies the character encoding, sets the viewport behaviour, loads the title into the tab, and downloads any stylesheets and scripts referenced there.
  4. Content pass: the browser walks the body, placing each element in the tree in document order.
  5. Render: the browser combines the DOM with the loaded CSS, calculates layout, and paints the page on screen.

Because parsing is top-down, order matters. The charset declaration should appear near the top of the head so the browser knows how to decode every byte that follows. The title should be present early so the tab label updates promptly. This is also why unstyled content can flash briefly if a stylesheet loads slowly — the structure is rendered as soon as it is parsed.


6. The Head Section in Detail

The head never appears as page content, but almost everything important about the page is declared there. The elements you will use most often:

ElementPurposeExample
meta charsetDeclares the character encoding so text, symbols and Indian-language scripts display correctly.<meta charset="UTF-8">
meta viewportMakes the page width follow the device width, essential for responsive design.<meta name="viewport" content="width=device-width, initial-scale=1.0">
titleSets the text in the browser tab and the name used in bookmarks and search results.<title>JustAcademy Notes</title>
linkConnects external resources, most commonly a CSS file.<link rel="stylesheet" href="styles.css">
scriptLoads or contains JavaScript.<script src="app.js" defer></script>
meta descriptionA short summary that search engines may show under your page title.<meta name="description" content="Learn HTML5 page structure.">

A typical head for a small project looks like this:

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Beginner notes on HTML5 page structure.">
  <title>HTML5 Page Structure — Web Foundations</title>
  <link rel="stylesheet" href="styles.css">
  <script src="app.js" defer></script>
</head>

The defer attribute on the script tells the browser to download the JavaScript now but run it only after the document has been fully parsed — a safe default when your script needs to touch page elements.


7. The Body and Its Landmark Regions

Inside the body, HTML5 gives you named structural elements called landmarks. Before HTML5, developers wrapped everything in meaningless div containers and labelled them with classes. Landmarks replace that guesswork with elements whose names describe their role.

ElementRole on the pageTypical content
headerIntroductory material for the page or for a section.Logo, site name, main heading
navA block of major navigation links.Menu, table of contents
mainThe primary content of the page. Only one per page.Articles, product listings, lesson text
sectionA thematic grouping of content, usually with its own heading.Chapter, features block, syllabus part
articleSelf-contained content that makes sense on its own.Blog post, news item, comment
asideContent tangentially related to the main content.Sidebar, related links, tip box
footerClosing material for the page or a section.Copyright, contact links, sitemap

The same page-level pattern repeats at smaller scale: an article can have its own header and footer, and a section can contain further section elements. Structure is fractal — the same idea at every size.


8. Worked Example: The Smallest Valid Page

Start with the absolute minimum that renders something on screen. This is a good first file to create and open in a browser:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>My First Page</title>
  </head>
  <body>
    <h1>Hello, web!</h1>
    <p>This is my first HTML5 page.</p>
  </body>
</html>

Save it as index.html and open it in a browser. You will see a large heading and a paragraph, and the tab will read "My First Page". Notice what is missing: there is no viewport meta and no stylesheet. That is fine for a first experiment, but the boilerplate from the syntax section above is what you should use for real work, because it anticipates phones and CSS from the start.


9. Worked Example: A Structured Lesson Page

Now build a realistic content page using landmarks. This example is a single lesson page — close to the kind of page you are reading right now:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Lesson: structuring an HTML5 page with landmarks.">
    <title>Page Structure — Web Foundations</title>
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>
    <header>
      <p class="site-name">Web Foundations</p>
      <nav aria-label="Main menu">
        <ul>
          <li><a href="/">Home</a></li>
          <li><a href="/html/">HTML</a></li>
          <li><a href="/css/">CSS</a></li>
          <li><a href="/js/">JavaScript</a></li>
        </ul>
      </nav>
    </header>

    <main>
      <article>
        <header>
          <h1>HTML5 Page Structure</h1>
          <p>Module: HTML5 &amp; Semantic Markup</p>
        </header>

        <section>
          <h2>The document skeleton</h2>
          <p>Every page starts with a doctype, an html element,
             a head for metadata and a body for content.</p>
        </section>

        <section>
          <h2>Landmark elements</h2>
          <p>Use header, nav, main, aside and footer to name
             the regions of your page.</p>
        </section>

        <footer>
          <p>Written for beginners. Last reviewed by the course team.</p>
        </footer>
      </article>

      <aside>
        <h2>Related lessons</h2>
        <ul>
          <li><a href="/html/forms/">HTML Forms</a></li>
          <li><a href="/html/semantic-tags/">Semantic Tags</a></li>
        </ul>
      </aside>
    </main>

    <footer>
      <p>&copy; Web Foundations course notes.</p>
    </footer>
  </body>
</html>

Several deliberate choices are worth noticing:

  • There is exactly one main, and it holds the article plus the related-lessons sidebar, both of which belong to this page's primary content area.
  • The inner header and footer belong to the article, not the page — the same element can scope to its nearest ancestor section.
  • The nav carries aria-label="Main menu" so that a screen reader with several navigation blocks can tell them apart.
  • The ampersand in the module name is written as &amp; because & must always be escaped in text content.

10. Worked Example: A Business Landing Page

Landing pages are the most common real-world structure. This example shows how section blocks stack inside main to form a scrollable page, with a call-to-action area and a full footer:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FreshBite — Healthy Meal Delivery</title>
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>
    <header class="site-header">
      <a href="/" class="logo">FreshBite</a>
      <nav aria-label="Site navigation">
        <ul>
          <li><a href="#menu">Menu</a></li>
          <li><a href="#plans">Plans</a></li>
          <li><a href="#contact">Contact</a></li>
        </ul>
      </nav>
    </header>

    <main>
      <section id="hero">
        <h1>Fresh meals, delivered daily</h1>
        <p>Chef-cooked, calorie-counted lunches for busy weekdays.</p>
        <a href="#plans" class="button">See plans</a>
      </section>

      <section id="menu">
        <h2>This week's menu</h2>
        <article>
          <h3>Paneer wrap bowl</h3>
          <p>Grilled paneer, brown rice, mint chutney.</p>
        </article>
        <article>
          <h3>Sprout salad plate</h3>
          <p>Moong sprouts, cucumber, lemon dressing.</p>
        </article>
      </section>

      <section id="plans">
        <h2>Weekly plans</h2>
        <p>Choose five lunches a week, pause any time.</p>
      </section>
    </main>

    <footer id="contact">
      <section>
        <h2>Contact</h2>
        <p>Email: [email protected]</p>
      </section>
      <p><small>&copy; FreshBite. All rights reserved.</small></p>
    </footer>
  </body>
</html>

The navigation links use fragment addresses such as #menu to jump to sections by their id. This is a small but very common structural technique: landmarks plus id attributes give you in-page navigation for free, with no JavaScript at all.


11. Old Structure Versus HTML5 Structure

Seeing the before-and-after makes the value of semantic structure obvious. Both versions below render identically in a browser, but they are not equally useful to browsers, screen readers or search engines.

Old pattern (div-based)HTML5 pattern (landmark-based)
<div class="header"><header>
<div class="nav"><nav>
<div class="content"><main>
<div class="post"><article>
<div class="sidebar"><aside>
<div class="footer"><footer>

Here is the same page top written both ways:

<!-- Old style: meaning lives only in class names -->
<div class="header">
  <div class="nav">...links...</div>
</div>
<div class="content">...page content...</div>
<div class="footer">...copyright...</div>

<!-- HTML5 style: meaning lives in the elements themselves -->
<header>
  <nav>...links...</nav>
</header>
<main>...page content...</main>
<footer>...copyright...</footer>

The div version still has a place: when you need a container purely for styling or scripting and it has no structural meaning, a div is the honest choice. The rule of thumb is simple — use a landmark element when the region has a name, and use div when it does not.


12. Nesting and Indentation Practice

Because structure is hierarchical, how you lay out the code affects how readable it is. Follow these habits from your first file:

  • Indent each nesting level by two or four spaces, so children sit visibly inside their parents.
  • Keep one element per line for block-level structural tags such as header, main and section.
  • Close tags immediately after opening them, then fill in the content — this prevents the classic "where does this tag end?" problem.
  • Use comments like <!-- /header --> sparingly, only in long files where the closing tag is far from its opener.

Correctly nested code reads like an outline:

<body>
  <header>
    <nav>
      <ul>
        <li><a href="/">Home</a></li>
      </ul>
    </nav>
  </header>
  <main>
    <h1>Welcome</h1>
  </main>
</body>

Every browser also ships developer tools (usually opened with F12) that show the parsed DOM as a tree. Inspecting any professional page and expanding its body is one of the fastest ways to internalise real-world structure — you will see header, main and footer patterns repeated across almost every modern site.


13. Common Structural Mistakes to Avoid

  • Missing or wrong doctype. Without <!DOCTYPE html>, browsers fall back to an old compatibility mode with quirky behaviour. Always start the file with it.
  • More than one main. The primary content area must be unique. If you find yourself writing a second main, one of them is really a section.
  • Wrapping everything in divs. If a container has a recognisable role — navigation, primary content, footer — give it the matching landmark element instead.
  • Putting visible content in the head. The head is for metadata only; anything a visitor should see belongs in the body.
  • Skipping the viewport meta. Without it, phones render the page at a desktop width and zoom out, making text tiny. Include it in every project.
  • Improper nesting. An inline element such as a should not wrap large block structures, and a p element cannot contain other block-level containers. When in doubt, keep containers of the same kind inside each other.
  • Empty landmarks. A nav with no links or a footer with no content adds noise for screen readers. Every landmark you add should earn its place.

Checking your structure is easy: open developer tools, look at the DOM tree, and confirm that your page reads as a clean outline — html at the root, head and body beneath it, and named landmarks inside the body. If the outline makes sense to you at a glance, it will make sense to the browser, to a screen reader and to a search engine too.

14. Advanced Real-World Page Structures

Once you are comfortable with the basic skeleton, you meet situations that the simple examples did not cover. Three patterns appear constantly in professional work: multiple navigation blocks, long pages divided into many sections, and pages whose content repeats.

Multiple navigation blocks

Larger sites often have more than one nav: a main menu at the top, a category menu in a sidebar, and a list of quick links in the footer. This is perfectly valid — but each one should be labelled so users of assistive technology can tell them apart:

<header>
  <nav aria-label="Main menu">
    <ul>
      <li><a href="/">Home</a></li>
      <li><a href="/courses/">Courses</a></li>
    </ul>
  </nav>
</header>

<aside>
  <nav aria-label="Course topics">
    <ul>
      <li><a href="#html">HTML</a></li>
      <li><a href="#css">CSS</a></li>
    </ul>
  </nav>
</aside>

<footer>
  <nav aria-label="Footer links">
    <ul>
      <li><a href="/about/">About</a></li>
      <li><a href="/contact/">Contact</a></li>
    </ul>
  </nav>
</footer>

Deciding between article, section and div

This is the question beginners ask most often. A simple test helps: ask what the block is, in one sentence, without mentioning its position or appearance.

Ask yourselfIf yes, use
Would this content make complete sense on its own, for example in a feed or an RSS item?article
Is this a themed group of related content that needs its own heading?section
Is this supporting content related to, but not essential for, the surrounding content?aside
Is this container needed only for styling or scripting, with no meaning of its own?div

For example, on a course page, each lesson summary is an article (it stands alone), the "Frequently asked questions" block is a section (a themed group inside the page), and a wrapper added purely to apply a background colour is a div.

Long pages with repeated structure

When a page lists many similar items — products, lessons, testimonials — each item gets the same inner structure. Keeping that inner structure identical makes the page predictable for readers and easy to style:

<section>
  <h2>Student testimonials</h2>
  <article>
    <h3>Priya</h3>
    <p>The HTML module gave me the confidence to build my first page.</p>
  </article>
  <article>
    <h3>Arjun</h3>
    <p>Clear structure made CSS layout much easier to learn.</p>
  </article>
</section>

When you later learn React, this pattern maps directly onto components: the repeated article block becomes one component rendered for each item in a list. Learning to spot repetition now is preparation for component thinking later.


15. Comments and Organising Large Pages

HTML comments are written between <!-- and -->. The browser ignores them completely; they exist only for humans reading the source. Used well, they turn a five-hundred-line file into something a teammate can navigate:

<!-- ===== Site header ===== -->
<header>
  ...
</header>

<!-- ===== Main content ===== -->
<main>
  ...
</main>

<!-- ===== Site footer ===== -->
<footer>
  ...
</footer>

Good commenting habits:

  • Mark the start of each major landmark, so a reader can scan the file and find regions quickly.
  • Explain why something unusual exists, not what it is — the tags already say what they are.
  • Never leave large blocks of dead code commented out in a finished file; delete it and rely on version control (Git, covered later in this course) to keep history.

Remember that comments are visible to anyone who opens your page source, so never put passwords, keys or private notes in them.


16. More Common Mistakes and the Correct Way

Part one listed the big structural errors. Here are the subtler ones that appear once you start writing longer, more realistic pages — each shown wrong, then right.

Using headings out of order

Heading levels (h1 to h6) form an outline. Jumping levels, or using them for visual size instead of meaning, breaks that outline.

<!-- Wrong: h3 before any h2, levels used for size -->
<h1>Our courses</h1>
<h3>Web development</h3>
<h6>Small print</h6>

<!-- Right: levels follow the outline, size is CSS's job -->
<h1>Our courses</h1>
<h2>Web development</h2>
<p class="fine-print">Small print</p>

Putting block containers inside a paragraph

<!-- Wrong: a p element cannot contain a list -->
<p>Before you start:
<ul>
  <li>Install a browser</li>
  <li>Choose an editor</li>
</ul>
</p>

<!-- Right: split the paragraph and place the list between them -->
<p>Before you start:</p>
<ul>
  <li>Install a browser</li>
  <li>Choose an editor</li>
</ul>

Using landmarks for one-off decorative blocks

<!-- Wrong: an aside that is really just a styled box -->
<aside>
  <p>Special offer!</p>
</aside>

<!-- Right: a div with a class, since it has no structural role -->
<div class="promo-box">
  <p>Special offer!</p>
</div>

Duplicating ids

An id must be unique across the whole page. Duplicate ids break fragment links (#section jumps) and make DOM scripting unreliable.

<!-- Wrong -->
<section id="intro">...</section>
<section id="intro">...</section>

<!-- Right -->
<section id="intro">...</section>
<section id="pricing">...</section>

Forgetting the language attribute

A page without lang on the html element leaves screen readers guessing how to pronounce the content. Always set it:

<html lang="en">

17. Best Practices for Page Structure

  • Start every file from the same boilerplate. Keep a saved template with the doctype, lang, charset, viewport, title and links to your CSS and JS, and copy it for each new page.
  • One h1 per page, placed near the top of main. It names the page; everything below it nests under it in the outline.
  • Exactly one main, containing the primary content. Navigation and site-wide footers stay outside it.
  • Name every landmark that could be confused with another. Use aria-label on multiple nav elements.
  • Choose elements for meaning first, styling second. If you cannot say what a container is, it is probably a div — and that is fine.
  • Keep ids unique and meaningful. id="pricing" is better than id="block2", and it doubles as a fragment-link target.
  • Indent consistently and close tags as you open them. Most editors auto-indent HTML; let them.
  • Test with keyboard and zoom. Press Tab to walk through your links in order, and zoom the page — a well-structured page survives both.
  • Validate early. A quick check of nesting and required elements catches problems while they are still cheap to fix.
A useful habit: read your page's structure out loud as an outline — "header with a menu, main with one article, three sections, footer with contact links." If the spoken outline sounds like a sensible document, your structure is sound.

18. Practical Project: Build a Course Notes Page

This project walks you through building a complete, realistic page from an empty file: a course notes page with a header, in-page navigation, several content sections, a sidebar and a footer. Every step produces something you can save and view.

Step 1: Create the file and the skeleton

Create a folder called web-foundations and inside it a file called index.html. Start with the boilerplate:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Course notes for Web Foundations: HTML, CSS and JavaScript.">
    <title>Web Foundations — Course Notes</title>
  </head>
  <body>
  </body>
</html>

Step 2: Add the header with site identity and main menu

<header>
  <p class="site-name">Web Foundations</p>
  <nav aria-label="Main menu">
    <ul>
      <li><a href="#html">HTML</a></li>
      <li><a href="#css">CSS</a></li>
      <li><a href="#javascript">JavaScript</a></li>
    </ul>
  </nav>
</header>

The link targets are fragment addresses — they will jump to sections you create in the next step.

Step 3: Add main with the page heading and first section

<main>
  <h1>Course Notes</h1>
  <p>Beginner-friendly notes for the Web Foundations module.</p>

  <section id="html">
    <h2>HTML5 and Semantic Markup</h2>
    <p>Learn how pages are structured, how forms capture input,
       and how semantic tags describe meaning.</p>
    <article>
      <h3>Page structure</h3>
      <p>The skeleton: doctype, head, body and landmark elements.</p>
    </article>
    <article>
      <h3>Forms</h3>
      <p>Inputs, labels and validation attributes.</p>
    </article>
  </section>
</main>

Step 4: Add the remaining sections

Copy the pattern of step 3 for CSS and JavaScript, changing the id, the headings and the text:

  <section id="css">
    <h2>CSS3 and Responsive Design</h2>
    <p>Selectors, the box model, Flexbox, Grid and media queries.</p>
  </section>

  <section id="javascript">
    <h2>JavaScript Fundamentals</h2>
    <p>Variables, conditions, loops, functions, arrays and objects.</p>
  </section>

Step 5: Add an aside for related resources

  <aside>
    <h2>Study tips</h2>
    <ul>
      <li>Build one small page per topic.</li>
      <li>Read your code out loud as an outline.</li>
      <li>Inspect real websites with developer tools.</li>
    </ul>
  </aside>

Step 6: Add the footer

<footer>
  <p>&copy; Web Foundations course notes.</p>
  <nav aria-label="Footer links">
    <ul>
      <li><a href="#html">HTML</a></li>
      <li><a href="#css">CSS</a></li>
      <li><a href="#javascript">JavaScript</a></li>
    </ul>
  </nav>
</footer>

Step 7: Save, open and review

  1. Save the file and open it in your browser.
  2. Click each header menu link and confirm the page jumps to the matching section.
  3. Open developer tools with F12, expand the body in the DOM tree, and check the outline: header, main (with one h1 and three sections), aside, footer.
  4. Resize the window narrow — the text should reflow and stay readable because of the viewport meta.

You now have a complete, valid, semantically structured page — and a personal template you can reuse for every future topic in this course.


19. Practice Exercises

  1. Write the minimal HTML5 boilerplate from memory, then open it in a browser and use a validation check to confirm it is correct.
  2. Take any three paragraphs of text and wrap them in a full page structure with a header, one main and a footer.
  3. Build a page with two nav elements and give each a distinct aria-label. Test that both are reachable with the Tab key.
  4. Convert this div-based fragment into landmark elements: <div class="top"><div class="menu">...</div></div><div class="content">...</div><div class="bottom">...</div>
  5. Create a page with four sections and a header menu of fragment links that jump to each one. Verify every jump works.
  6. Find one real website, open its source, and list which landmark elements it uses. Note any place where it uses div where a landmark would fit.
  7. Deliberately create a duplicate id on two sections, add fragment links to both, and observe which one the browser jumps to. Then fix the ids so each is unique.
  8. Add an article inside a section, and give the article its own header and footer. Confirm the page still validates.

20. Interview Questions and Answers

What is the purpose of the DOCTYPE declaration?

<!DOCTYPE html> tells the browser to treat the document as a standards-mode HTML5 document. Without it, browsers switch to a legacy compatibility mode with inconsistent layout behaviour, so it must be the first line of every HTML file.

What is the difference between the head and the header element?

head is a required document-level container for metadata such as the title, charset and stylesheet links; nothing inside it is displayed as page content. header is a visible landmark inside the body that holds introductory content such as a logo, site name or page heading. A page has exactly one head but may have several header elements — one for the page and one inside each article or section.

Why should a page have only one main element?

main represents the primary content of the document, and that uniqueness is what makes it useful: screen readers can jump straight to it, and search engines can identify the core content. If two regions both feel like primary content, one of them is really a section or an aside.

When would you use a div instead of a semantic element?

When the container has no structural meaning and exists only for styling or scripting — for example, a wrapper that applies a background colour or a flex layout. Choosing div in that case is correct practice, not a failure; the mistake is using div for regions that do have meaning, such as navigation or the page footer.

What is the difference between article and section?

An article is self-contained content that would make sense on its own, such as a blog post or a product card. A section is a thematic grouping within a larger document, such as a chapter or a features block. The test: if the block could be syndicated or reused independently, it is an article; if it only makes sense as part of the surrounding page, it is a section.

How does the browser use page structure?

The browser parses the HTML top to bottom and builds the DOM, a tree of objects. Structural elements become branches of that tree, which CSS selectors target and JavaScript traverses. A clean structure therefore makes styling predictable and DOM scripting reliable.

What role does the viewport meta tag play in page structure?

<meta name="viewport" content="width=device-width, initial-scale=1.0"> tells mobile browsers to size the page to the device width instead of pretending it is a desktop page. Without it, responsive CSS cannot work as intended, because the layout is computed against a full desktop width and then zoomed out.

Why is the lang attribute important?

lang on the html element declares the page language. Screen readers use it to choose pronunciation rules, browsers use it for translation prompts and spell-checking, and search engines use it as a language signal. Omitting it degrades accessibility for every visitor using assistive technology.

Can a header element appear more than once on a page?

Yes. A header scopes to its nearest ancestor sectioning element, so a page-level header can coexist with a header inside each article. The same applies to footer. Only main is limited to one per page.

What is the document outline and why do heading levels matter?

The outline is the hierarchy formed by heading levels h1 through h6. Screen reader users often navigate by headings, and search engines weigh them as content signals. Levels should follow the logical structure — no skipped levels, no choosing a level for its visual size — because size and weight are styling concerns handled by CSS.

How does good HTML structure help SEO?

Search engines parse structure to understand a page: a single main highlights the primary content, headings describe its topics, the title and meta description feed the search result display, and landmark elements remove ambiguity about what each region is. Well-structured pages are easier to interpret, which supports better indexing.

Why does HTML structure matter when learning React?

React components ultimately render into an HTML document, and modern React can render on the server and send pre-built HTML to the browser. Whether you write JSX or plain HTML, the same rules apply: one main, meaningful landmarks, correct heading order and unique ids. Developers who understand page structure produce components that are accessible and search-friendly from the start.


21. Quick Revision Checklist

  • I can write the HTML5 boilerplate from memory: doctype, html lang, head with charset and viewport, title, and body.
  • I know the head holds metadata and the body holds visible content.
  • I can name all seven landmark elements and say what each is for: header, nav, main, section, article, aside, footer.
  • I use exactly one main and one page-level h1.
  • I can decide between article, section, aside and div using the meaning test.
  • I label multiple nav elements with aria-label.
  • My ids are unique, and I can build fragment links with #id.
  • I close tags in the order I opened them and indent nested elements consistently.
  • I never put visible content in the head or private information in comments.
  • I can inspect any page's DOM tree in developer tools and read its outline.

Conclusion

Page structure is the skill that everything else in web development rests on. CSS makes a page beautiful only if the structure underneath is sound; JavaScript finds and changes elements only if the DOM tree is organised; React components render into a document whose skeleton you now understand completely. You have learned the fixed outer shell every document needs, the landmark elements that name each region of content, how the browser turns your file into a rendered page, and the habits — one main, one h1, meaningful elements, unique ids, consistent indentation — that separate professional markup from guesswork. Keep the course notes page you built in the project section: you will style it with CSS in the next module, script it with JavaScript after that, and in doing so watch one well-structured document grow into a complete, modern web application.

Learn more in the React JS Training course, or register for a course demo.

Next
whatsapp