SemSure
←Full Stack Web Development · Unit 1HTML structure, links, tables and multimedia✓ 0/41/66
① Topic

HTML structure, links, tables and multimedia

Definition
HTML gives a page structure and meaning. The browser builds a document from elements, attributes and text.

Opens chatgpt.com in a new tab with a ready-made prompt for this topic.

① Topic

Document, headings and text blocks

index.html
<!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>
① Topic

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.

① Topic

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().

① Topic

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.

① Topic

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.

① Topic

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.

② Question

Style four sentences in one paragraph · May 2025 Q21a

8Asked in: May 2025 Q21a
Create one paragraph of four sentences, each with a different font style, colour and size.
③ Learn · step 1 of 3

Keep one text block

Use one p with four span children. Normal spaces between the spans keep the sentences readable.

③ Learn · step 2 of 3

Give each span its own style

Use a distinct class and specify family, style or weight, size and colour. Put the selectors inside head.

③ Learn · step 3 of 3

Check the paragraph

All four colours, sizes and families differ. The sentences stay inline and wrap normally.

④ Exam answer

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.

sentences.html
<!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>
② Question

Build the musician portfolio · May 2025 Q26

15Asked in: May 2025 Q26
Build a musician page with a large #3399FF name heading, image, semantic biography, embedded audio player and social links.
③ Learn · step 1 of 4

Sketch the structure

Use header for the name, main for the figure and two labelled sections, and footer/nav for socials.

③ Learn · step 2 of 4

Style the exact heading

Set h1 to 3rem and #3399FF. Limit image width without distorting its aspect ratio.

③ Learn · step 3 of 4

Embed a playable track

Add audio controls and a source with type audio/mpeg. Include a fallback and use relative asset paths.

③ Learn · step 4 of 4

Check the assets

Supply the photo and track, then set the social links to the musician's actual profiles.

④ Exam answer

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.

musician.html · supply photo.jpg and track.mp3
<!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>
② Question

Explain the HTML document skeleton · Jul 2025 Q21a

8Asked in: Jul 2025 Q21a
Explain the main elements of a basic HTML document and give an example.
③ Learn · step 1 of 3

Set parsing and language

Write the HTML doctype first. html is the root and lang describes the content language.

③ Learn · step 2 of 3

Separate metadata

Put charset, viewport and title inside head. The title appears in the browser tab.

③ Learn · step 3 of 3

Add visible structure

Body contains header, main and footer. Close nested tags in order.

④ Exam answer

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.

index.html
<!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>
② Question

Build the six-row employee table · Jul 2025 Q26

15Asked in: Jul 2025 Q26
List the basic table elements. Build a six-row, three-column page with a merged “Employee Details” title, Name/Age/Phone number headers and four employees. Use a blue table, green title row, Times New Roman, 2px border, 10px cell padding, centred text and yellow hover on every row.
③ Learn · step 1 of 4

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.

③ Learn · step 2 of 4

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.

③ Learn · step 3 of 4

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.

③ Learn · step 4 of 4

Trace the output

At rest the title is green and other rows are blue. Hovering any row turns it yellow with dark text.

④ Exam answer

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.

employees.html
<!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>
② Question

Create the multimedia profile · Nov 2025 Q21b

8Asked in: Nov 2025 Q21b
Create a multimedia HTML5 profile with embedded CSS, headings, text blocks, lists, a styled table, rounded image, background colours and a button with a hover animation.
③ Learn · step 1 of 3

Plan the blocks

Write heading, photo, paragraph, unordered skills list, captioned table and audio controls.

③ Learn · step 2 of 3

Style the document in head

Add body and card backgrounds, a rounded responsive image and padded cell borders.

③ Learn · step 3 of 3

Animate and verify

Scale up at the midpoint of a keyframe animation. Trigger it on hover or focus and supply the local media files.

④ Exam answer

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.

profile.html · supply profile.jpg and intro.mp3
<!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>
① Topic

Cascade, box model and layout

Definition
CSS rules style matching elements. Each rendered element has content surrounded by padding, border and margin.

Opens chatgpt.com in a new tab with a ready-made prompt for this topic.

① 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.

① Topic

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.

① Topic

Margins, padding, alignment and floating

margin | border | padding | CONTENT | padding | border | margin
  20        5        10       200        10         5       20  = 270 px
① Topic

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.

① Topic

Modern layouts

Flexbox for a row, Grid for a layout
nav ul { display: flex; flex-wrap: wrap; gap: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
① Topic

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.

② Question

Calculate the CSS box model · Jul 2025 Q21b

8Asked in: Jul 2025 Q21b
Explain the CSS box model and its influence on page layout with an example.
③ Learn · step 1 of 3

Draw the four areas

margin | border | padding | CONTENT | padding | border | margin
  20        5        10       200        10         5       20  = 270 px
③ Learn · step 2 of 3

Calculate occupied width

With content-box add both padding and border edges to 200 for 230px. Add both margins for 270px.

③ Learn · step 3 of 3

Compare sizing modes

With border-box, the border box is 200px, content is 170px and total width including margins is 240px.

④ Exam answer

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.

Width in normal flow
.card {
  width: 200px;
  padding: 10px;
  border: 5px solid navy;
  margin: 20px;
  box-sizing: content-box;
}
.compact { box-sizing: border-box; }
① Topic

Transforms, transitions, CSS animation and canvas

Definition
Transforms reposition or reshape the drawn box. Transitions animate a property change and keyframes describe a timed sequence.

Opens chatgpt.com in a new tab with a ready-made prompt for this topic.

① 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.

① Topic

Transition and hover practice

transforms.html
<!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>
① Topic

Keyframes and canvas

CSS
@keyframes flash { from { opacity: 0.5; } to { opacity: 1; } }
.status { animation: flash 300ms ease-out; }
Script after <canvas id="art" width="300" height="150"></canvas>
const ctx = document.querySelector("#art").getContext("2d");
ctx.fillStyle = "navy";
ctx.fillRect(10, 10, 50, 30);
// For motion, clearRect and redraw on requestAnimationFrame.
② Question

Demonstrate two 2D transformations · May 2025 Q21b

8Asked in: May 2025 Q21b
Use HTML and CSS examples to explain any two 2D transformations or transitions.
③ Learn · step 1 of 3

Name two operations

translateX(16px) shifts the drawing right. rotate(12deg) turns it clockwise.

③ Learn · step 2 of 3

Write a trigger

Give each button its own class. Apply the transform on hover or keyboard-visible focus.

③ Learn · step 3 of 3

Compare before and after

The original layout space stays in place. A transition animates the change smoothly.

④ Exam answer

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.

transforms.html
<!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>
② Question

Use transforms and transitions for feedback · Nov 2025 Q21a

8Asked in: Nov 2025 Q21a
Explain how CSS transformations and transitions improve the user experience, with syntax and an example.
③ Learn · step 1 of 3

Separate geometry from timing

Declare the destination transform on hover or focus and declare duration, property and easing in the baseline rule.

③ Learn · step 2 of 3

Connect the change to feedback

The shift or tilt signals interactivity and neighbours keep their normal-flow positions.

③ Learn · step 3 of 3

Check the return

The base transition applies as hover or focus leaves. Reduced-motion users get the state change without interpolation.

④ Exam answer

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.

transforms.html
<!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>
Practice

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.

Practice

Which element is a table header cell?

Which element is a table header cell?

Practice

Which rule stops a large image overflowing?

Which rule stops a large image overflowing?

Practice

Which property controls line spacing?

Which property controls line spacing?

Practice

Which old tag scrolls text?

Which old tag scrolls text?

Practice

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