HTML structure and common tags
FoundationHTML marks content with paired tags. Skeleton: DOCTYPE, html, head (for the browser), body (for visitors). Common: h1-h6 headings, p paragraphs, ul/ol+li lists, a links, img images; semantic tags header/nav/main/footer let machines read the structure too.
- HTML is a markup language: paired tags wrap content; last opened, first closed.
- The skeleton's four pieces: DOCTYPE, html, head (for the browser), body (for visitors).
- Everyday tags: h1-h6 headings, p paragraphs, ul/ol with li lists, a links, img images.
文體小知識:編程教學課每個概念都配一段可以親手試的代碼例子,照住輸入、改一改,最快學會。
§Text Passage
1The skeleton of every web page is HTML (HyperText Markup Language): not a programming language but a markup language — pairs of tags tell the browser 'this is a heading, this is a paragraph'. Nearly all tags come in pairs: in <p>Hello!</p>, <p> opens and </p> closes (with a slash), and the text between is the content.
2Every HTML file shares one skeleton: <!DOCTYPE html> declares HTML5; <html> wraps everything; <head> holds information for the browser (the page title, the text encoding) which never shows on the page; <body> holds everything a visitor sees. Save the code as index.html and open it in a browser to see the page — that is how web writing starts.
3The most used tags come in a few families: headings <h1> to <h6> (a page normally has one <h1>); paragraphs <p>; lists, <ul> with <li> (bulleted) or <ol> with <li> (numbered); hyperlinks <a href="url">text</a>; images <img src="photo.jpg" alt="caption"> (a single tag, no closing). Extra details attached to a tag — href, src, alt — are called attributes.
4Newer HTML encourages semantic tags: <header> for the page top, <nav> for the menu, <main> for the chief content, <footer> for the bottom. They look like <div> but state what each part is for, letting search engines and screen readers (software reading pages aloud for blind users) understand the structure — a page is not only drawn for people, it also speaks to machines.
1Summary 重點摘要
HTML marks content with paired tags. Skeleton: DOCTYPE, html, head (for the browser), body (for visitors). Common: h1-h6 headings, p paragraphs, ul/ol+li lists, a links, img images; semantic tags header/nav/main/footer let machines read the structure too.
2Vocabulary cards Vocabulary
The markup language behind web pages, using tags to describe content's structure and meaning.
A marker in angle brackets, mostly in pairs: opening <p>, closing </p>.
The whole of an opening tag, its content and the closing tag — <p>Hello</p> is one paragraph element.
Extra information inside an opening tag, e.g. href on <a href="...">, src and alt on <img>.
head holds information for the browser (title, encoding); body holds everything shown to visitors.
The link tag whose href gives the destination, e.g. <a href="https://...">go</a>.
A single tag: src names the image file, alt carries the description text.
Structure tags declaring purpose: header, nav, main, footer.
Tags inside tags, layer by layer; the first opened closes last, never crossing.
3Step by step Steps
- The smallest page skeletonEvery page file shares one skeleton: <!DOCTYPE html> declares an HTML5 document; <html> wraps everything; <head> holds browser-facing information such as <title>My page</title>, which shows on the browser tab rather than on the page; <body> holds everything a visitor sees. Save the skeleton as index.html and open it in a browser: the tab shows 'My page' and the page shows 'Hello!'. The skeleton is every page's foundation and must be memorised exactly.
- Headings and paragraphs<h1> to <h6> are six heading levels, h1 the largest and h6 the smallest; a page normally uses one h1 as the main title, with h2 and h3 subdividing the sections level by level — never skipping. <p> wraps a paragraph with automatic spacing before and after, as in writing <h1>Class 3A home</h1> and <p>My first web page.</p> inside body. Heading levels do more than set font size: they declare the document's structure to search engines and screen readers, and misused headings leave blind visitors lost.
- Two kinds of listsTwo list kinds exist. The unordered list ul with li shows bullets: <ul><li>football</li><li>chess</li></ul>; the ordered list ol numbers itself 1. 2.: <ol><li>boot up</li><li>log in</li></ol>. The choosing standard is whether order carries meaning: a hobby list has no order and takes ul; procedure steps are order-critical and take ol. Every li must sit inside a ul or ol — placing li directly in body is invalid, and although the browser may still display it, the structure is already wrong.
- Links and imagesLinks use the a tag: <a href="https://www.labzstudy.com">Visit LabzStudy</a>, with href holding the destination and the text between being the clickable part; for another page on your own site write a relative path like <a href="about.html">About us</a>. Images use the single img tag: <img src="images/campus.jpg" alt="A panorama of the campus">, where src points to the image location and alt is the description shown when the image cannot be seen; screen readers for the visually impaired speak the alt text, so it must never be left empty.
- Semantic tagsSemantic tags state each part's purpose: <header> for the page top, <nav> for the navigation menu, <main> for the chief content, <footer> for the bottom. Inside body place them in order: <header>Class 3A site</header>, <nav>Home | Gallery</nav>, <main>Welcome to our class site</main>, <footer>© 2026 Class 3A</footer>. They look like div but tell machines what each region is, letting search engines and screen readers understand the structure. A page is not only drawn for people — it also speaks to machines.
- The nesting rule: last opened, first closedTag nesting obeys 'last opened, first closed': for bold inside a paragraph write <p>This is <strong>key</strong> content</p> — strong opens inside p and must close before p closes. The crossed form <p>...<strong>...</p></strong> may still render in lenient browsers, but the structure is wrong, the layout may fall apart, and the page's DOM tree becomes illegal. Check from the inside out: the tag opened last must close first, like packing small cases before big ones and unpacking small ones first.
- Attributes and how to learnAttributes are extra information inside the opening tag, written name='value': href, src, alt, class and id are all attributes, and one tag may carry several, separated by spaces. The most effective way to learn HTML is write-and-look: create index.html in a text editor, save after every change and refresh the browser to see the effect at once. HTML rarely reports errors — it quietly misbehaves instead — so build the habit of small edits followed by immediate checks, and mistakes will never pile up.
4Diagrams Diagrams
5Worked example Example
Example: build a small 'about me' page with a page title, one main heading, a self-introduction paragraph, a hobby list and one external link.
- Write the skeleton: <!DOCTYPE html> <html> <head><title>About me</title></head> <body>...</body> </html> — the title shows on the browser tab.
- Add heading and paragraph: inside body write <h1>I am Mary</h1> <p>A student from 3A who loves sports and computing.</p>.
- Add the hobby list: <ul><li>basketball</li><li>coding in Python</li><li>photography</li></ul> — three items, bullets automatic.
- Add the link and close: <a href="https://www.labzstudy.com">My favourite study site</a>, then finish with </body> </html>.
- Answer: The finished page is the skeleton plus four parts: title, h1+p, a ul list, an a link — saved as an .html file and opened in any browser.
6Common mistakes Mistakes
7Quick check Quick check
Q1Where does visible page content go? A. <head> B. <body> C. <title>
Q2How many <h1> should a page normally have?
Q3Write the link tag going to about.html with the text 'About us'.
Q4What is the img tag's alt attribute for?
Q5What are <nav>, <main> and <footer> collectively called, and why use them?
8Recap Recap
- HTML is a markup language: paired tags wrap content; last opened, first closed.
- The skeleton's four pieces: DOCTYPE, html, head (for the browser), body (for visitors).
- Everyday tags: h1-h6 headings, p paragraphs, ul/ol with li lists, a links, img images.
- Attributes sit in the opening tag: href for destinations, src for image files, alt as the required description.
- Semantic tags header/nav/main/footer let machines read the page structure too.