HTML structure, links, tables and multimedia
Opens chatgpt.com in a new tab with a ready-made prompt for this topic.
Document, headings and text blocks
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Music club</title>
</head>
<body>
<header><h1>Music club</h1></header>
<main><p>Rehearsals are on Fridays.</p></main>
<footer>Campus music club</footer>
</body>
</html>Validate and debug
Start with doctype and UTF-8, then validate markup for nesting and missing attributes. Inspect the parsed DOM in DevTools because browser recovery can silently move or close tags. Check the Network panel and relative paths for media that fail to load.
Fonts, colours and emphasis
Use font-family with fallbacks, font-size and font-style. Use em and strong for emphasis and importance. A span styles an inline run and div groups blocks. Paragraphs collapse normal whitespace. br inserts a break and hr a thematic break. Colour can be a name, #RRGGBB, rgb() or hsl().
Lists and tables
ol numbers items, ul adds bullets and dl pairs dt terms with dd descriptions. A table uses tr rows, th headers and td data. caption names the table, thead and tbody group rows, and colspan or rowspan merges cells.
External and internal links
Use <a href="https://example.com/"> for an external destination, <a href="about.html"> for a neighbouring document and <a href="#bio"> to jump to id="bio". Use descriptive link text.
Images and media
img uses src and meaningful alt text, with empty alt for decoration. figure and figcaption group content and captions. audio and video expose controls, source supplies alternatives and track provides video captions. An iframe can embed a hosted player when the provider permits it.
Style four sentences in one paragraph · May 2025 Q21a
Keep one text block
Use one p with four span children. Normal spaces between the spans keep the sentences readable.
Give each span its own style
Use a distinct class and specify family, style or weight, size and colour. Put the selectors inside head.
Check the paragraph
All four colours, sizes and families differ. The sentences stay inline and wrap normally.
Booklet answer · Style four sentences in one paragraph · May 2025 Q21a
The p defines the paragraph. Each span marks one inline sentence and has its own class. The internal stylesheet uses font shorthand for size, family and distinct weights or styles. The color property sets the foreground, and fallback families preserve readability.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Four sentences</title>
<style>
.one { font: normal 16px Georgia, serif; color: navy; }
.two { font: italic 19px Arial, sans-serif; color: maroon; }
.three { font: oblique 22px "Courier New", monospace; color: darkgreen; }
.four { font: bold italic small-caps 25px Verdana, sans-serif; color: purple; }
</style>
</head>
<body>
<p>
<span class="one">The concert starts at six.</span>
<span class="two">The club meets every Friday.</span>
<span class="three">Bring your own instrument.</span>
<span class="four">Guests are welcome.</span>
</p>
</body>
</html>Build the musician portfolio · May 2025 Q26
Sketch the structure
Use header for the name, main for the figure and two labelled sections, and footer/nav for socials.
Style the exact heading
Set h1 to 3rem and #3399FF. Limit image width without distorting its aspect ratio.
Embed a playable track
Add audio controls and a source with type audio/mpeg. Include a fallback and use relative asset paths.
Check the assets
Supply the photo and track, then set the social links to the musician's actual profiles.
Booklet answer · Build the musician portfolio · May 2025 Q26
The page uses h1 for the name, figure for the portrait and a semantic section with its own heading for the biography. Audio exposes browser-native playback controls. The footer groups external profile links in nav. Doctype, language, encoding and viewport settings make the document portable.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Mira Rao · Music</title>
<style>
body { max-width: 48rem; margin: auto; padding: 1rem; font-family: system-ui, sans-serif; }
h1 { color: #3399FF; font-size: 3rem; }
img { max-width: 100%; height: auto; }
</style>
</head>
<body>
<header><h1>Mira Rao</h1></header>
<main>
<figure>
<img src="photo.jpg" alt="Mira Rao performing with a violin">
<figcaption>Live at the campus music festival</figcaption>
</figure>
<section aria-labelledby="bio">
<h2 id="bio">Biography</h2>
<p>Mira is a violinist who blends Carnatic phrases with acoustic folk music.</p>
</section>
<section aria-labelledby="listen">
<h2 id="listen">Listen</h2>
<audio controls>
<source src="track.mp3" type="audio/mpeg">
<a href="track.mp3">Download the track</a>
</audio>
</section>
</main>
<footer>
<nav aria-label="Social profiles">
<a href="https://www.instagram.com/miraraomusic/">Instagram</a>
<a href="https://www.youtube.com/@miraraomusic">YouTube</a>
</nav>
</footer>
</body>
</html>Explain the HTML document skeleton · Jul 2025 Q21a
Set parsing and language
Write the HTML doctype first. html is the root and lang describes the content language.
Separate metadata
Put charset, viewport and title inside head. The title appears in the browser tab.
Add visible structure
Body contains header, main and footer. Close nested tags in order.
Booklet answer · Explain the HTML document skeleton · Jul 2025 Q21a
The doctype selects standards mode. The html root contains head and body. Head supplies UTF-8 encoding, viewport settings for mobile layout and the page title. Body holds visible content, with semantic introductory, main and footer regions. meta is a void element and has no closing tag.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Music club</title>
</head>
<body>
<header><h1>Music club</h1></header>
<main><p>Rehearsals are on Fridays.</p></main>
<footer>Campus music club</footer>
</body>
</html>Build the six-row employee table · Jul 2025 Q26
Lay out six rows
Use colspan="3" for the title th, three column headers in row two and four data rows with three cells each.
Style table and cells
Give the table its blue background and Times New Roman. Apply two-pixel solid borders with border-collapse and ten-pixel cell padding.
Handle the title and hover
Give the title its own class. Set hover on tr with enough specificity to override green. Leave cells transparent so the hover colour shows.
Trace the output
At rest the title is green and other rows are blue. Hovering any row turns it yellow with dark text.
Booklet answer · Build the six-row employee table · Jul 2025 Q26
table contains the complete grid, tr defines a row, th a header and td data. thead groups title and headings, tbody groups the four records and colspan merges the title across three columns. Centre the cell text using text-align and the whole table using automatic margins.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Employee Details</title>
<style>
table {
background: blue;
color: white;
font-family: "Times New Roman", serif;
border-collapse: collapse;
margin: auto;
}
table, th, td { border: 2px solid black; }
th, td { padding: 10px; text-align: center; }
.title { background: green; }
table tr:hover { background: yellow; color: black; }
</style>
</head>
<body>
<table aria-label="Employee Details">
<thead>
<tr class="title"><th colspan="3">Employee Details</th></tr>
<tr><th scope="col">Name</th><th scope="col">Age</th><th scope="col">Phone number</th></tr>
</thead>
<tbody>
<tr><td>Asha</td><td>22</td><td>000-000-0001</td></tr>
<tr><td>Kiran</td><td>24</td><td>000-000-0002</td></tr>
<tr><td>Mira</td><td>26</td><td>000-000-0003</td></tr>
<tr><td>Dev</td><td>29</td><td>000-000-0004</td></tr>
</tbody>
</table>
</body>
</html>Create the multimedia profile · Nov 2025 Q21b
Plan the blocks
Write heading, photo, paragraph, unordered skills list, captioned table and audio controls.
Style the document in head
Add body and card backgrounds, a rounded responsive image and padded cell borders.
Animate and verify
Scale up at the midpoint of a keyframe animation. Trigger it on hover or focus and supply the local media files.
Booklet answer · Create the multimedia profile · Nov 2025 Q21b
The profile combines semantic content with an internal stylesheet. The responsive image has alternative text and rounded corners. Audio uses native controls. A table caption describes the table and th cells label columns. The button pulse applies a three-stage keyframe sequence on hover or keyboard focus.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Student profile</title>
<style>
body { background: #eaf5ff; color: #172b44; font: 1rem system-ui, sans-serif; }
main { background: white; max-width: 40rem; margin: auto; padding: 1.5rem; }
img { max-width: 100%; height: auto; border-radius: 16px; }
table { border-collapse: collapse; }
th, td { border: 1px solid #49627d; padding: 8px; }
th { background: #d8e7ff; }
button:hover, button:focus-visible { animation: pulse 500ms ease-in-out; }
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
button:hover, button:focus-visible { animation: none; }
}
</style>
</head>
<body>
<main>
<h1>Asha's music profile</h1>
<img src="profile.jpg" alt="Asha with her guitar">
<p>I arrange acoustic covers and perform at campus events.</p>
<h2>Skills</h2>
<ul><li>Guitar</li><li>Songwriting</li></ul>
<table>
<caption>Recent performances</caption>
<tr><th scope="col">Event</th><th scope="col">Year</th></tr>
<tr><td>Acoustic Night</td><td>2025</td></tr>
</table>
<h2>Introduction</h2>
<audio controls src="intro.mp3"><a href="intro.mp3">Download audio</a></audio>
<p><button type="button">Featured artist</button></p>
</main>
</body>
</html>Cascade, box model and layout
Opens chatgpt.com in a new tab with a ready-made prompt for this topic.
Where CSS lives
Use style on one element, a style block in head for a page, or <link rel="stylesheet" href="site.css"> for reusable rules. For ordinary author rules, importance and cascade layer come before specificity. With those equal, the more specific and then the later rule wins.
Selectors, text and navigation
p selects elements, .card reusable classes and #intro a unique ID. nav a:hover matches hovered links inside nav. list-style changes list markers, line-height sets line box height and text-align centres inline content. Give navigation links visible focus.
Margins, padding, alignment and floating
margin | border | padding | CONTENT | padding | border | margin 20 5 10 200 10 5 20 = 270 px
Normal flow and positioning
Use margin-inline: auto to centre a block with a constrained width. float lets inline content wrap around media. clear moves an element below prior floats. Relative positioning retains flow space. Absolute positioning leaves flow and commonly uses the nearest positioned ancestor. Fixed is usually viewport-relative, and sticky sticks after a threshold within its scrolling context.
Modern layouts
nav ul { display: flex; flex-wrap: wrap; gap: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }Backgrounds and borders
Combine background-color and background-image with repeat, position and size such as cover. Border requires width, style and colour. border-radius rounds corners. Padding is inside the border and margins separate boxes. Vertical margins can collapse in normal block flow.
Calculate the CSS box model · Jul 2025 Q21b
Draw the four areas
margin | border | padding | CONTENT | padding | border | margin 20 5 10 200 10 5 20 = 270 px
Calculate occupied width
With content-box add both padding and border edges to 200 for 230px. Add both margins for 270px.
Compare sizing modes
With border-box, the border box is 200px, content is 170px and total width including margins is 240px.
Booklet answer · Calculate the CSS box model · Jul 2025 Q21b
Content holds text or media. Padding gives an inner gap, border encloses it and margin creates outer separation. For .card the painted box is 200 + 2(10 + 5) = 230px, with 270px including margins. For .card.compact, 200 includes padding and border, giving 170px content and 240px including margins. These footprints affect how many elements fit on a row.
.card {
width: 200px;
padding: 10px;
border: 5px solid navy;
margin: 20px;
box-sizing: content-box;
}
.compact { box-sizing: border-box; }Transforms, transitions, CSS animation and canvas
Opens chatgpt.com in a new tab with a ready-made prompt for this topic.
2D and 3D transforms
translate moves, rotate turns, scale resizes and skew shears. Transform order matters and transform-origin sets the pivot. rotate3d(x, y, z, angle) turns around a vector, and perspective creates depth.
Transition and hover practice
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Transform demo</title>
<style>
button { margin: 1rem; padding: .6rem; transition: transform 250ms ease; }
.move:hover, .move:focus-visible { transform: translateX(16px); }
.turn:hover, .turn:focus-visible { transform: rotate(12deg); }
@media (prefers-reduced-motion: reduce) {
button { transition: none; }
}
</style>
</head>
<body>
<button class="move">Translate me</button>
<button class="turn">Rotate me</button>
</body>
</html>Keyframes and canvas
@keyframes flash { from { opacity: 0.5; } to { opacity: 1; } }
.status { animation: flash 300ms ease-out; }const ctx = document.querySelector("#art").getContext("2d");
ctx.fillStyle = "navy";
ctx.fillRect(10, 10, 50, 30);
// For motion, clearRect and redraw on requestAnimationFrame.Demonstrate two 2D transformations · May 2025 Q21b
Name two operations
translateX(16px) shifts the drawing right. rotate(12deg) turns it clockwise.
Write a trigger
Give each button its own class. Apply the transform on hover or keyboard-visible focus.
Compare before and after
The original layout space stays in place. A transition animates the change smoothly.
Booklet answer · Demonstrate two 2D transformations · May 2025 Q21b
A 2D transform acts in the page plane. Translation offsets coordinates while rotation changes orientation around the centre by default. Declare both with transform: function(value). Set transition on the base button so entering and leaving the hovered state both interpolate over 250 ms.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Transform demo</title>
<style>
button { margin: 1rem; padding: .6rem; transition: transform 250ms ease; }
.move:hover, .move:focus-visible { transform: translateX(16px); }
.turn:hover, .turn:focus-visible { transform: rotate(12deg); }
@media (prefers-reduced-motion: reduce) {
button { transition: none; }
}
</style>
</head>
<body>
<button class="move">Translate me</button>
<button class="turn">Rotate me</button>
</body>
</html>Use transforms and transitions for feedback · Nov 2025 Q21a
Separate geometry from timing
Declare the destination transform on hover or focus and declare duration, property and easing in the baseline rule.
Connect the change to feedback
The shift or tilt signals interactivity and neighbours keep their normal-flow positions.
Check the return
The base transition applies as hover or focus leaves. Reduced-motion users get the state change without interpolation.
Booklet answer · Use transforms and transitions for feedback · Nov 2025 Q21a
A transform changes an element's visual coordinates. translateX shifts it and rotate turns it around its origin. A transition interpolates values, for example transition: transform 250ms ease. Transform and transition provide pointer and keyboard feedback without shifting surrounding layout. A transition needs a property change, whereas an animation can sequence several keyframes.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Transform demo</title>
<style>
button { margin: 1rem; padding: .6rem; transition: transform 250ms ease; }
.move:hover, .move:focus-visible { transform: translateX(16px); }
.turn:hover, .turn:focus-visible { transform: rotate(12deg); }
@media (prefers-reduced-motion: reduce) {
button { transition: none; }
}
</style>
</head>
<body>
<button class="move">Translate me</button>
<button class="turn">Rotate me</button>
</body>
</html>Where do title, charset and viewport go?
Where do title, charset and viewport go?
Opens chatgpt.com in a new tab with a ready-made prompt for this topic.
Which element is a table header cell?
Which element is a table header cell?
Which rule stops a large image overflowing?
Which rule stops a large image overflowing?
Which property controls line spacing?
Which property controls line spacing?
Which old tag scrolls text?
Which old tag scrolls text?
Which transform rotates about an arbitrary 3D axis?
Which transform rotates about an arbitrary 3D axis?
Unit 1 checklist
Before you move on, can you do each of these without looking?
0 of 4 topics complete
Not sure about one? Go back to it in the topic list and press Next step through the worked question once more. Ticks are saved in this browser. Final checklist for the subject →
Unit complete. Up next: Unit 2, JavaScript, React JS Overview.
All units