CHAPTER 02 · HTML
What HTML does: content, meaning and the other web languages
HTML helps you describe the information on a page. In this chapter, you will learn why it exists, what its name means and how it works alongside CSS and JavaScript. You will also see what a plain HTML page can and cannot do.
Download example files (ZIP)What you will learn
Explain HTML without memorising a difficult definition. Read a small heading and paragraph example. Tell a tag, an element and an attribute apart at an introductory level. Choose whether a requirement belongs to HTML, CSS, JavaScript or a server. Avoid confusing a plain-looking page with a broken page.
Why do we need HTML?
What the name means
Hypertext is content connected through links. A link can take you to another document or a place within a document. Markup is the use of markers to describe parts of the content. In HTML, many of those markers are tags such as <p>.Language means an agreed set of names and writing rules that browsers understand.
Your first small pieces of HTML
<h1>Weekend study group</h1>
<p>We will revise one topic together each Saturday.</p>.html filename and show their browser previews.
<p>We will revise one topic together each Saturday.</p>:
<p>is the opening tag. It starts the paragraph.The sentence is the content. </p>is the closing tag. The slash marks the end.The whole paragraph, including its tags and content, is an element.
Extra information: an attribute
<html lang="en">lang is the attribute name and en is its value. Together, they say that the document's main language is English. This does not translate the page into English. It tells tools how to interpret the language the author has written.
HTML, CSS and JavaScript have different jobs
- 1HTML: describe the content
- 2CSS: arrange and style it
- 3JavaScript: add application behaviour
HTML already supports links and other built-in behaviour. Saving submitted information reliably usually needs a receiving service too.
Is HTML a programming language?
A complete example: a skill-sharing session
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Skill-sharing Session</title>
</head>
<body>
<h1>Share one skill</h1>
<p>Each student will explain one useful computer shortcut.</p>
<p>Bring a notebook and one question.</p>
</body>
</html>This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.
Problem and solution: separate three requests
What HTML alone does not promise
A beautiful design: default browser styling is only a starting point. A saved account: an input field does not create a working registration system by itself. Identical appearance everywhere: fonts, browser settings and screen sizes vary. Privacy for hidden information: visitors can inspect downloaded HTML. Do not place passwords or private keys in it. Correctness just because something appears: browsers can recover from some writing mistakes.
Common mistakes and useful tips
Calling HTML a tool for every calculation: choose the tool that fits the job. Thinking CSS replaces HTML: CSS styles a document; it does not remove the need for meaningful content. Believing JavaScript is needed to show a paragraph: plain HTML already supports that. Using heading elements only to make text large: describe the role first, then style it later. Copying code without reading the message it creates: ask whether a visitor would understand it.
Practice questions
Explain HTML to a friend in one sentence without using the word markup. In <p>Bring your notebook.</p>, identify the opening tag, content and whole element.What information does lang="en"provide? Does it translate text?Which tool would normally change the space between two paragraphs? Can the complete skill-sharing example display without JavaScript? A club wants to keep submitted registrations after the browser closes. Why is a form's HTML alone not enough to promise this?
Check your practice answers
HTML tells a browser how the content of a web page is organised, such as which text is a heading or paragraph. <p>starts the paragraph, Bring your notebook. is its content, and the full marked paragraph is the element.It identifies English as the main language for that element and its content unless overridden. It does not translate the words. CSS normally controls that spacing. Yes. It is a complete document with text content and no script dependency. A form can describe fields and submit values, but a service must receive, check and store them if reliable saved registrations are required.
Interview questions
What is HTML used for?
How are HTML and CSS different?
Are a tag and an element the same thing?
<p>. A paragraph element includes its content and the tags that describe it. Some elements, such as meta, have no closing tag or child content in HTML.
Why learn meaningful HTML if a browser can display poorly written markup?
Quick revision
HTML describes content and its organisation. Tags mark elements; attributes supply extra information. CSS controls appearance, and JavaScript can add application behaviour. HTML includes some built-in behaviour; it is not just a picture of a page. A complete application may also need a server and storage. Build a clear document before worrying about decoration.