search

HTML Layout

Sep 04, 2024 pm 04:15 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

While designing a web page, we must arrange the web page elements in an elegant way. They should be easy to navigate for the user and simple. It provides a way to arrange these elements in a well-structured manner. HTML layout gives a very good look to the web page and provides an easy way to design. It is a simple way by which we can design web elements using simple standard HTML tags. HTML offers various layout elements by using which we can design various parts of the web page.

HTML Layout Elements

In this article, we will see different layout elements and their examples. Using these elements, we will design a simple structure similar to the newspaper.

1.

This element is used to define the header of the web page. It contains the title of the page or some logo or maybe introductory content.

Code:



<title> EduCba </title>


<header style="height: 100px; width: 100%; background-color: #607D8B;">
<h1 id="Header-Section"> Header Section</h1>
</header>

Output:

HTML Layout

2.

This element will contain links to the menu list. This element is like a container for different navigation links. The links will be on a different page or the same page.

Code:

Let us add a navigation element below our last example’s header. Add

<style>
li{
display: inline-flex;
padding: 25px
}
ul{
text-align: center;
}
</style>


<nav style="background-color: #607d8b70;">
<ul>
<li> <a href="#"> Navigation Link1 </a> </li>
<li> <a href="#"> Navigation Link2 </a> </li>
<li> <a href="#"> Navigation Link3 </a> </li>
</ul>
</nav>

Output:

HTML Layout

3.

This element is like the main section of the web page. It can contain any kind of information. It can contain text, images, etc.

4.

As the name suggests, this element will contain content like a paragraph, any detailed description of something, or any kind of information. Generally, this will be the main part containing information on a web page.

5.

This element will define the content at the side of the main content, like a section or article. This information element is optional and generally contains additional information or advertisement content.

Code:

Let’s add all these three elements together below the navigation bar.

<style>
li { display: inline-flex;
padding: 25px
}
section{
background-color: #607D8B;
width: 79%;
position: absolute;
height: 150px;
}
article{
width: 79%;
background-color: #607d8b70;
position: absolute;
top: 368px;
height: 150px;
}
aside{
background-color: #607d8b99;
width: 20%;
position: absolute;
left: 80%;
height: 300px;
}
h2 , p {
text-align: center;
color: #9c27b0;
}
ul{
text-align: center;
}
</style>

<div class="main">
<section>
<h2 id="Section-Part"> Section Part </h2>
<p> Some Text </p>
</section>
<article>
<h2 id="Article-Part"> Article Part </h2>
<p> Some Detailed Text </p>
</article>
<aside>
<h2 id="Sidebar-Part"> Sidebar Part </h2>
<p> This will contain static part or anything like advertisement etc. </p>
</aside>
</div>

Output:

HTML Layout

6.

This element displays extra details about the web page to the user. This may contain additional information which is optional for the user. This element, by default, provides a feature to show or hide details upon clicking.

7.

This element is used along with the

element. The information which is to be hidden and will be shown upon click will be in this tag. This element will be inside the details element.

Code:

Let us add details elements along with the summary element in our existing example. Add the code below after our aside section and article element parts in the

tag.
<details>
<summary> Summary: click here to show details</summary>
<p> Details: Upon clicking summary element, details will be shown to the user </p>
</details>

<style>
details {
margin-top: 330px;
width: 100%;
padding-top: 10px;
padding-bottom: 50px;
padding-left: 15px;
background-color: #607d8bdb;
}
details p {
font-size: 18px;
}
summary {
color: white;
font-size: 22px;
}
</style>

Output 1: Without clicking on the details element.

HTML Layout

Output 2: After clicking on the details element.

HTML Layout

8.

There will be one section at the bottom of every web page, known as a footer. This

element defines the footer section at the bottom of the web page. The footer section will generally contain copyrights, year, contact information, etc. It’s a standard practice to have a footer in the web pages, which will be at the bottom of a web page.

Code:

Let us add-footer on our web page at the bottom part.

<footer style=" height: 100px; background-color:#607D8B; width: 100%; text-align: center;">
<h3 id="Footer-Section">Footer Section</h3>
<p> © Copyright ( Year ) </p>
</footer>

Output:

HTML Layout

So our final code and its output will look like this,

Code:



 EduCba 



Header Section

Section Part

Some Text

Article Part

Some Detailed Text

Summary: click here to show details

Details: Upon clicking summary element, details will be shown to the user

<footer style=" height: 100px; background-color:#607D8B; width: 100%; text-align: center;"> <h3 id="Footer-Section">Footer Section</h3> <p> © Copyright ( Year ) </p> </footer>

Output:

HTML Layout

Conclusion

So HTML layout elements are very much useful while designing a web page. They help developers to design well-structured web pages. Using these layout elements properly improves the reading experience of web pages. We have seen most of the main HTML layout elements in detail.

The above is the detailed content of HTML Layout. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Are the HTML tags and elements the same thing?Are the HTML tags and elements the same thing?Apr 28, 2025 pm 05:44 PM

The article explains that HTML tags are syntax markers used to define elements, while elements are complete units including tags and content. They work together to structure webpages.Character count: 159

What is the significance of <head> and <body> tag in HTML?What is the significance of <head> and <body> tag in HTML?Apr 28, 2025 pm 05:43 PM

The article discusses the roles of <head> and <body> tags in HTML, their impact on user experience, and SEO implications. Proper structuring enhances website functionality and search engine optimization.

What is the difference between <strong>, <b> tags and <em>, <i> tags?What is the difference between <strong>, <b> tags and <em>, <i> tags?Apr 28, 2025 pm 05:42 PM

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.

Please explain how to indicate the character set being used by a document in HTML?Please explain how to indicate the character set being used by a document in HTML?Apr 28, 2025 pm 05:41 PM

Article discusses specifying character encoding in HTML, focusing on UTF-8. Main issue: ensuring correct display of text, preventing garbled characters, and enhancing SEO and accessibility.

What are the various formatting tags in HTML?What are the various formatting tags in HTML?Apr 28, 2025 pm 05:39 PM

The article discusses various HTML formatting tags used for structuring and styling web content, emphasizing their effects on text appearance and the importance of semantic tags for accessibility and SEO.

What is the difference between the 'id' attribute and the 'class' attribute of HTML elements?What is the difference between the 'id' attribute and the 'class' attribute of HTML elements?Apr 28, 2025 pm 05:39 PM

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for

What is the 'class' attribute in HTML?What is the 'class' attribute in HTML?Apr 28, 2025 pm 05:37 PM

The article explains the HTML 'class' attribute's role in grouping elements for styling and JavaScript manipulation, contrasting it with the unique 'id' attribute.

What are different types of lists in HTML?What are different types of lists in HTML?Apr 28, 2025 pm 05:36 PM

Article discusses HTML list types: ordered (<ol>), unordered (<ul>), and description (<dl>). Focuses on creating and styling lists to enhance website design.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.