HTML layouts are a technique used to divide a web page into multiple sections, making it easier to apply styles, organize content, and manage operations efficiently. This division improves readability, accessibility, and overall user experience.
HTML layout is achieved through elements like <header>, <nav>, <main>, <article>, <section>, <aside>, and <footer> which help organize content, define the page’s sections, and improve SEO.

Syntax:
<header> Content... </header>
<nav> Content... </nav>
<main> Content... </main>
<footer> Content... </footer>
HTML
<html>
<body>
<header>
<h1>My Website</h1>
</header>
<main>
<p>Welcome to my website!</p>
</main>
<footer>
<p> 2024 My Website</p>
</footer>
</body></html>
- <header> contains the main heading of the page.
- <main> holds the primary content.
- <footer> includes the footer information.
Layout Components
Layouts
| Descriptions
|
|---|
Header
| The top section of a webpage, often containing the website title, logo, or navigation links. The <header> tag is used to define this part of the page.
|
Navigation bar
| A menu that provides links to the main sections of the website. The <nav> tag is used to define navigation elements in the webpage.
|
Index / Sidebar
| An optional section often found on the side, used for additional content such as ads, links, or other related information.
|
Content Section
| The central area where the primary content of the page is displayed. The <main> tag is used to define the main content of a webpage.
|
Footer
| The bottom section of the webpage, typically containing contact information, legal links, or additional site-related information. The <footer> tag is used to define this area.
|
More Examples:
Layout with Additional Semantic Tags
html
<html>
<body>
<header>
<h1>My Blog</h1>
</header>
<nav>
<a href="#">Home</a> | <a href="#">About</a> | <a href="#">Contact</a>
</nav>
<section>
<h2>Latest Posts</h2>
<article>
<h3>Post Title</h3>
<p>This is a brief introduction to the blog post.</p>
</article>
</section>
<aside>
<h2>About Me</h2>
<p>Short bio or profile information.</p>
</aside>
<footer>
<p>© 2024 My Blog</p>
</footer>
</body>
</html>
- <nav> provides navigation links for the website.
- <section> groups related content, here titled “Latest Posts.”
- <article> represents an individual blog post.
- <aside> contains supplementary information, such as an “About Me” section
Styled Layout with Semantic Tags
HTML
<html >
<head>
<style>
header {
background-color: #4caf50;
color: white;
text-align: center;
padding: 1em;
}
nav {
background-color: #333;
overflow: hidden;
}
main {
padding: 20px;
}
footer {
background-color: #4caf50;
color: white;
text-align: center;
padding: 1em;
}
</style>
</head>
<body>
<header>
<h1>Styled Page</h1>
</header>
<nav>
<a href="#">Home</a>
<a href="#">Services</a>
<a href="#">Contact</a>
</nav>
<main>
<h2>Welcome!</h2>
<p>This is a simple page.</p>
</main>
<footer>
<p>© 2024 Styled Page</p>
</footer>
</body>
</html>
- Header: The <header> element contains the main heading of the page, providing a clear introduction.
- Main: The <main> element holds the primary content, ensuring semantic clarity and improved accessibility.
Techniques for Creating HTML Layouts
There are several techniques to create multi-column layouts in HTML:
- CSS Frameworks (like Bootstrap): Speed up layout design with pre-built components and grid systems.
- CSS Float Property: A classic method for positioning elements, though it requires careful handling to avoid layout issues with normal document flow.
- CSS Flexbox: Ideal for responsive and dynamic layouts, easily adjusting content across different screen sizes.
- CSS Grid: Allows for complex, two-dimensional layouts with ease, providing more control over placement.
HTML is the foundation of web pages and is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
Best Practices for HTML Layout
- Use semantic HTML5 elements like <header>, <nav>, <main>, and <footer> to clearly define the structure of your webpage.
- Ensure responsive design by using relative units and media queries to make your layout adaptable to different screen size
HTML Layout – FAQ’s
What is the purpose of the <div> element in HTML layout?
The <div> element is a block-level container used to group other elements, allowing for easier styling and layout control with CSS.
How can I center content horizontally in an HTML layout?
To center content horizontally, you can use CSS properties like margin: auto; for block elements or text-align: center; for inline elements within a parent container.
How do you create a grid layout in HTML?
Use CSS Grid Layout with properties like display: grid;, grid-template-columns, and grid-template-rows to create complex, flexible layouts using rows and columns.
How do I create a fixed header or footer in my HTML layout?
To create a fixed header or footer, apply position: fixed; along with top: 0; for headers or bottom: 0; for footers, and set the appropriate width and z-index values.
What is a responsive layout in HTML?
A responsive layout adjusts based on screen size and device orientation using CSS media queries, ensuring that content is accessible and visually appealing across different devices
Similar Reads
HTML Tutorial
HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. It tells the web browser how to display text, links, images, and other forms of multimedia on a webpage. HTML sets up the basic structure of a website, and then CSS and JavaScript
11 min read
HTML Introduction
HTML stands for HyperText Markup Language. It is the standard language used to create and structure content on the web. HTML is a markup language, not a programming language, meaning it annotates text to define how it is structured and displayed by web browsers.It forms the building blocks of all we
5 min read
HTML Editors
An HTML Editor is a software application designed to help users create and modify HTML code. It often includes features like syntax highlighting, tag completion, and error detection, which facilitate the coding process. There are two main types of HTML editors: Text-Based Editors - Allow direct codi
5 min read
HTML Basics
HTML (HyperText Markup Language) is the standard markup language for creating and structuring web pages. It defines the structure of a webpage using elements and tags.HTML is responsible for displaying text, images, and other content.It serves as the foundation for building websites and web applicat
6 min read
HTML Comments
HTML comments are used to add notes or explanations in the HTML code that are not displayed by the browser. They are useful for documenting the code, making it easier to understand and maintain.To add a comment, use the syntax <!-- your comment here -->. [GFGTABS] HTML <!-- This is a commen
4 min read
HTML Elements
An HTML Element consists of a start tag, content, and an end tag, which together define the element's structure and functionality. Elements are the basic building blocks of a webpage and can represent different types of content, such as text, links, images, or headings. For example, the <p> el
5 min read
HTML Attributes
HTML Attributes are special words used within the opening tag of an HTML element. They provide additional information about HTML elements. HTML attributes are used to configure and adjust the element's behavior, appearance, or functionality in a variety of ways. Each attribute has a name and a value
9 min read
HTML Headings
HTML headings are used to define the titles and subtitles of sections on a webpage. They help organize the content and create a structure that is easy to navigate. Proper use of headings enhances readability by organizing content into clear sections.Search engines utilize headings to understand page
4 min read
HTML Paragraphs
A paragraph in HTML is simply a block of text enclosed within the <p> tag. The <p> tag helps divide content into manageable, readable sections. Itâs the go-to element for wrapping text in a web page that is meant to be displayed as a distinct paragraph. Syntax: <p> Content</p
5 min read
HTML Text Formatting
HTML text formatting refers to the use of specific HTML tags to modify the appearance and structure of text on a webpage. It allows you to style text in different ways, such as making it bold, italic, underlined, highlighted, or struck-through. Table of Content Categories of HTML Text FormattingLogi
4 min read