Start with the HTML5 doctype and essential meta tags for character encoding and responsive design. 2. Use semantic elements like <header>, <nav>, <main>, <section>, <article>, <aside>, and <footer> to structure the page meaningfully. 3. Apply CSS Grid for layout styling and include responsive media queries to ensure mobile compatibility, resulting in a clean, accessible, and responsive webpage layout that follows modern web development best practices.

Creating a simple webpage layout with HTML5 is straightforward once you understand the semantic structure HTML5 provides. Instead of relying solely on <div> tags, HTML5 introduces meaningful elements that define different parts of a page, making your code cleaner and more accessible.<img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/175382187424995.jpeg" class="lazy" alt="How to structure a simple webpage layout with HTML5?"><p>Here’s how to structure a basic, responsive-friendly webpage layout using HTML5:</p>
<hr>
<h3 id="Use-the-HTML-Document-Structure">1. Use the HTML5 Document Structure</h3>
<p>Start with the correct doctype and basic structure:</p>
<img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/175382187585686.jpeg" class="lazy" alt="How to structure a simple webpage layout with HTML5?"><pre class='brush:php;toolbar:false;'><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Simple Webpage</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!-- Page content goes here -->
</body>
</html></pre><ul><li><code><!DOCTYPE html>
ensures modern rendering mode.
<meta charset="UTF-8">
sets character encoding.<meta name="viewport">
makes the page mobile-friendly.
2. Build a Semantic Layout with HTML5 Elements
Inside the <body>
, use semantic tags to define the layout:
<header>
<h1>Website Title</h1>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
</header>
<main>
<section id="home">
<h2>Welcome</h2>
<p>This is the home section of the website.</p>
</section>
<section id="about">
<h2>About Us</h2>
<p>Learn more about our story and mission.</p>
</section>
<article>
<h2>Latest Blog Post</h2>
<p>This is a featured article on the site.</p>
</article>
</main>
<aside>
<h3>Sidebar</h3>
<p>Additional info, ads, or links can go here.</p>
</aside>
<footer>
<p>© 2025 My Website. All rights reserved.</p>
</footer>
Key Semantic Elements Explained:
<header>
: Contains introductory content like logos, headings, and navigation.<nav>
: Wraps primary navigation links.<main>
: The main content of the page (only one per page).<section>
: Groups related content, usually with a heading.<article>
: Self-contained content like blog posts or news articles.<aside>
: Sidebar or tangential content.<footer>
: Contains footer information like copyright or contact info.
3. Style the Layout (Basic CSS Tips)
While this is about HTML structure, a little CSS helps visualize the layout. In your styles.css
:

body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: grid;
grid-template-areas:
"header header"
"main aside"
"footer footer";
gap: 10px;
min-height: 100vh;
}
header { grid-area: header; background: #4a90e2; padding: 1em; color: white; }
main { grid-area: main; padding: 1em; }
aside { grid-area: aside; background: #f0f0f0; padding: 1em; }
footer { grid-area: footer; background: #333; color: white; text-align: center; padding: 1em; }
nav ul {
list-style: none;
padding: 0;
}
nav ul li {
display: inline;
margin-right: 20px;
}
@media (max-width: 600px) {
body {
grid-template-areas:
"header"
"main"
"aside"
"footer";
}
}
This uses CSS Grid to create a clean, responsive layout that stacks on small screens.
Final Notes
- Always use semantic HTML5 elements where appropriate — it helps with SEO and accessibility.
- Keep your layout flexible so it works on mobile and desktop.
- Link an external CSS file early to separate content from style.
Basically, structure first with semantic HTML, then style it. That’s the modern way.
The above is the detailed content of How to structure a simple webpage layout with HTML5?. For more information, please follow other related articles on the PHP Chinese website!