Every HTML5 page, from the simplest to the most complex, is built on the same skeleton. Learning the skeleton once lets you start every future page correctly.
The Basic Skeleton
A complete page has a document type declaration, one <html> element, and inside it a <head> and a <body>. The head holds information about the page. The body holds everything the visitor sees.
Definition: DOCTYPE. The first line of a page, which tells the browser to use HTML5 rules.
Nesting means that one element sits completely inside another.
Tags, Elements and Attributes
A tag is a keyword inside angle brackets. Most tags come as a pair: an opening tag such as <p> and a closing tag such as </p>. The opening tag, the content and the closing tag together make an element. Some elements are empty and have only one tag, for example <br> and <img>.
An attribute gives extra information about an element. It is written inside the opening tag as a name and a value, for example lang="en". Values are placed in quotation marks.
Definition: Attribute. Extra information written inside an opening tag, as a name and a value.
What Goes in the Head
The <title> element sets the text shown on the browser tab and in search results. The element <meta charset="UTF-8"> tells the browser which character encoding the file uses, so that letters and symbols display correctly. Later units add links to style sheets in the head. Nothing in the head, except the title, appears on the page.
Rules of Good Structure
Elements must be closed in the reverse order from which they were opened. If a bold element is opened inside a paragraph, it must be closed before the paragraph is closed. Tag and attribute names are not case sensitive, but writing them in lowercase is the accepted style. Indenting the nested elements makes the structure easy to see and check.
Example 1.2: A minimal valid HTML5 page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My First Page</title>
</head>
<body>
<h1>Welcome</h1>
<p>This is my first HTML5 page.</p>
</body>
</html>
Output in the browser:
The tab shows the title text. The page shows only the heading and the paragraph.
Table 1.2: The main structural elements
| Element | Purpose |
|---|---|
<html> |
Wraps the whole page and can carry the language |
<head> |
Holds information about the page |
<title> |
Gives the page a name for the tab and search results |
<meta> |
States details such as the character encoding |
<body> |
Holds all the visible content |
Common mistakes
- Leaving out the DOCTYPE line, which can make the browser fall back to old rules.
- Placing visible content in the head, where it does not appear on the page.
- Closing tags in the wrong order, such as closing a paragraph before the bold element inside it.
- Forgetting the quotation marks around attribute values.
Key takeaways
- Every page has a DOCTYPE, an html element, a head and a body.
- An element is an opening tag, content and a closing tag. Empty elements have only one tag.
- Attributes belong in the opening tag as name and value pairs.
- Only the body content is shown on the page. The title appears on the tab.
Practice questions
- Which element holds everything the visitor sees?
- Name one empty element.
- What does the meta charset line do?
Answers to the practice questions
- The body element.
- br, which makes a line break. The img element is another.
- It states the character encoding of the file so that characters display correctly.
Sources
- Official BCA syllabus (NEP 2025 scheme), Web Application Development, course code 25BCA405DS04, Unit I
