New HTML5 Elements
HTML5 introduces many new elements that enrich the structure and meaning of content.
Structural Elements
header
<header>
<h1>Campus Information System</h1>
<nav>
<a href="home.html">Home</a>
<a href="profile.html">Profile</a>
</nav>
</header>
footer
<footer>
<p>© 2024 Technology University</p>
<nav>
<a href="privacy.html">Privacy Policy</a>
<a href="terms.html">Terms of Use</a>
</nav>
</footer>
nav
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="courses.html">Courses</a></li>
<li><a href="schedule.html">Schedule</a></li>
</ul>
</nav>
article
<article>
<h2>HTML5 Learning Guide</h2>
<p>Written by: John Smith</p>
<p>HTML5 is the latest version of HTML, bringing many new features.</p>
</article>
section
<section>
<h2>Module 1: HTML Basics</h2>
<p>In this module, we will learn the basics of HTML.</p>
</section>
aside
<aside>
<h3>Related Articles</h3>
<ul>
<li><a href="css-basics.html">Learn CSS</a></li>
<li><a href="js-basics.html">Learn JavaScript</a></li>
</ul>
</aside>
figure & figcaption
<figure>
<img src="diagram.png" alt="Architecture diagram">
<figcaption>Campus information system architecture diagram</figcaption>
</figure>
details & summary
<details>
<summary>Click to see the explanation</summary>
<p>HTML5 is the latest version of HTML, bringing many new features such as semantic elements, multimedia, and APIs.</p>
</details>
mark
<p>Use the <mark>mark</mark> tag to highlight important text.</p>
time & meter & progress
<p>The class starts on <time datetime="2024-01-15">January 15, 2024</time>.</p>
<meter value="0.7">70%</meter>
<progress value="70" max="100">70%</progress>
Case Study: Campus News Website
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Campus News</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', sans-serif;
line-height: 1.6;
color: #333;
}
header {
background: #1e3a5f;
color: white;
padding: 1rem 2rem;
}
header h1 {
font-size: 1.8rem;
}
nav ul {
list-style: none;
display: flex;
gap: 1rem;
margin-top: 0.5rem;
}
nav a {
color: white;
text-decoration: none;
}
nav a:hover {
text-decoration: underline;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
display: grid;
grid-template-columns: 1fr 300px;
gap: 2rem;
}
article {
background: white;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
article h2 {
color: #1e3a5f;
margin-bottom: 0.5rem;
}
.meta {
color: #666;
font-size: 0.9rem;
margin-bottom: 1rem;
}
aside {
background: #f8f9fa;
padding: 1.5rem;
border-radius: 8px;
border-left: 4px solid #d4af37;
}
aside h3 {
color: #1e3a5f;
margin-bottom: 1rem;
}
aside ul {
list-style: none;
}
aside li {
margin-bottom: 0.5rem;
}
aside a {
color: #1e3a5f;
text-decoration: none;
}
footer {
background: #1e3a5f;
color: white;
padding: 1rem 2rem;
text-align: center;
margin-top: 2rem;
}
footer nav a {
color: white;
text-decoration: none;
margin: 0 0.5rem;
}
</style>
</head>
<body>
<header>
<h1>Campus News</h1>
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="academic.html">Academic</a></li>
<li><a href="student-affairs.html">Student Affairs</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
</header>
<div class="container">
<article>
<h2>2024 New Student Admissions</h2>
<p class="meta">
Written by: <strong>Public Relations Team</strong> |
<time datetime="2024-01-10">January 10, 2024</time>
</p>
<p>Technology University is opening new student admissions for the 2024/2025 academic year.</p>
<p>Registration is open from <time datetime="2024-02-01">February 1, 2024</time> to <time datetime="2024-03-31">March 31, 2024</time>.</p>
<figure>
<img src="campus.jpg" alt="Technology University Campus" width="100%">
<figcaption>Technology University Main Building</figcaption>
</figure>
<section>
<h3>Registration Requirements</h3>
<ul>
<li>High school / vocational school diploma (SMA/SMK/MA)</li>
<li>Graduation certificate</li>
<li>3x4 ID photo</li>
<li>Registration fee payment proof</li>
</ul>
</section>
<section>
<h3>Registration Progress</h3>
<p>Quota filled:</p>
<progress value="750" max="1000">75%</progress>
<p>750 of 1000 quota filled</p>
</section>
</article>
<aside>
<h3>Related Articles</h3>
<ul>
<li><a href="scholarships.html">2024 Scholarships</a></li>
<li><a href="student-affairs.html">Student Activities</a></li>
<li><a href="research.html">Latest Research</a></li>
</ul>
<h3>Important Dates</h3>
<p><time datetime="2024-02-01">February 1</time>: Registration opens</p>
<p><time datetime="2024-03-31">March 31</time>: Registration closes</p>
<p><time datetime="2024-04-15">April 15</time>: Entrance exam</p>
</aside>
</div>
<footer>
<p>© 2024 Technology University. All rights reserved.</p>
<nav>
<a href="privacy.html">Privacy Policy</a>
<a href="terms.html">Terms & Conditions</a>
</nav>
</footer>
</body>
</html>
Everyday Case Study
Case: A developer needs to create an interactive FAQ for a student portal.
<details>
<summary>How do I apply for college?</summary>
<p>1. Open the registration portal</p>
<p>2. Fill in the registration form</p>
<p>3. Upload the required documents</p>
<p>4. Pay the registration fee</p>
</details>
<details>
<summary>How much is the tuition per semester?</summary>
<p>Tuition varies depending on the study program. On average ,000 - ,000 per semester.</p>
</details>
Best Practices
- Use semantic elements: For a clear structure
- details/summary: For expandable content
- figure/figcaption: For images with captions
- time: For dates and times in a standard format
- progress/meter: For displaying progress
Summary
New HTML5 elements expand what HTML can do when it comes to creating structured and interactive content. Use these elements to build a better website.