HTML5 is designed to facilitate a greater understanding of the information found on the web. Resolving many of the problems found in earlier versions of HTML, version 5 can handle the requirements of today's web applications. HTML5 provides the means to compartmentalize your pages, allowing both humans and computers to better understand and use the information presented.
To complete the tasks required to correct the code provided you should:
- Be familiar with HTML in general
- Understand the semantic fundamentals of HTML5
- Know which tag is appropriate for a given set of data
- Have a basic understanding of CSS3
In this practice exercise, you convert markup into the proper semantic format. Figure 1 shows the page you will use for this exercise. The page is called A Semantic Endeavor.
Figure 1. A Semantic Endeavor web page
The code shown in Listing 1 was written to create this page. However, it is semantically incorrect. Your task is to find and correct the six semantic errors in the code.
Listing 1. Incorrect page
<!doctype html>
<html>
<head>
<title>A Semantic Endeavor -- Before</title>
<style>
header h1 {
font-size: 20px;
margin: 0px;
color: #006;
}
header h2 {
font-size: 16px;
margin: 0px;
color: #99f;
font-style: italic;
}
p {
font-size: 15px;
margin-top: 0px;
margin-left: 50px;
}
</style>
</head>
<body>
<header>
<h1>A Semantic Endeavor</h1>
<h2>HTML5 Fundamentals</h2>
</header>
<menu>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">A Page</a></li>
<li><a href="#">Another Page</a></li>
</ul>
</menu>
<section>
<header>
<hgroup>
<h1>Story Heading</h1>
</hgroup>
</header>
<p> Primum non nocere ad vitam paramus tu quoque. Mutatis mutandis de
gustibus et coloribus non est disputandum Ad infinitum, ad nauseum. </p>
<article>
<header>
<h1>Part 1 of the story</h1>
</header>
<p>Scientia potentia est qua nocent docent ars longa, Vita brevis
alea lacta est vici. P rimum non nocere quid pro quo. Audaces fortuna
iuvat fortes fortuna adiuvat. </p>
</article>
<article>
<header>
<h1>Part 2 of the story</h1>
</header>
<p>Ave Caesar morituri te salutant. veni, vidi, vici. Mater semper
certa est, pater nunquam ignoramus et ignorabimus
ergo sum e pluribus unum.</p>
</article>
</section>
<footer>
<small>copyright 2011 Acme United. All rights reserved.</small>
</footer>
</body>
</html>
|
Follow these solution steps to check your work.
-
"HTML5
fundamentals, Part 1: Getting your feet wet" (developerWorks,
May 2011) provides an overview of the semantic structure of HTML5.
-
"Create
modern Web sites using HTML5 and CSS3" (developerWorks, March
2010) is a multicomponent HTML5 and CSS3 tutorial.
-
In "New elements in
HTML 5" (developerWorks, August 2007), you will find
information for several of the new elements in HTML5.
-
The <html>5doctor website provides an
excellent view of the current trends in HTML5.
-
The WHATWG
website provides detailed information for the HTML5 specification.
-
Stay current with developerWorks
technical events and webcasts focused on a variety of IBM products and
IT industry topics.
Grace Walker, a partner in Walker Automated Services in Chicago, Illinois, is an IT consultant with a diverse background and broad experience. She has worked in IT as a manager, administrator, programmer, instructor, business analyst, technical analyst, systems analyst, and Web developer in various environments, including telecommunications, education, financial services, and software.