Skip to main content

Featured

Space Explorers Book 7: Answers and Explanations

Memunic Space Explorers › Book 7: Memoon and the Search for Another Home › Answers and Explanations Answers and Explanations Habitable means life could live there; inhabited means life does live there. A world can be habitable and empty, as an unoccupied flat has a roof and water but nobody in it. The Moon has almost no air, so water would boil or freeze, and its gravity is only about one-sixth of Earth’s, too weak to keep air. Accept also: no greenhouse blanket, so it swings between very hot and very cold. Venus. It matches Earth in size and roughly in mass, but its thick carbon dioxide air traps heat, making it hot and crushing. “Twin” is only true for size and weight. A dip of 1 per cent means (planet width divided by star width) squared is 0.01, so the ratio is 0.1: the planet is about a tenth as wide as the star. Repeats at the same gap show the planet is going round the star in 12 days, and rule out a one-time event such as a passing object. A planet shines only by reflected l...

Byte by Byte Book 6: Chapter 10 – Building Web Pages with HTML

Byte by Byte › Book 6: Python, Data and How Computers Work › Chapter 10: Building Web Pages with HTML

Chapter 10: Building Web Pages with HTML

You will learn: what HTML is and how a browser displays it, the parts of an HTML element (tags, content and attributes), the basic structure of every web page, how to add headings, paragraphs, lists, links, images and tables, how to write good alt text, how to add colour and alignment the modern way, and how to create, save and view a web page with Notepad and Microsoft Edge.

🌟 The Adventure

News of the Festival reached the surface faster than Memoon expected. Two days later, a small brown sparrow landed on the jetty, a notebook under one wing and a press badge on her chest. It was Pip, the reporter from The Memunic Times, whom Memoon had met at the Festival of Makers.

"A city of fish under the sea!" chirped Pip. "A giant ancient computer! A light show on a wall! My readers will love it. But I can't dive, and my editor wants it on the Light Bridges by Friday, as a proper page that every village can open."

Behind her came Old Bramble, the badger who ran the newspaper's reading room, walking carefully with his white cane. "And make sure I can read it too," he said with a smile. "My screen reader can read words aloud to me. But when a page is full of pictures with no descriptions, all it says is image, image, image."

Memoon had used thousands of web pages. She had learned in Book 3 how they travelled across the Light Bridges from a server to a browser. But she had never asked herself what a web page actually was inside.

She opened one in Edge, right-clicked, and chose View page source. The screen filled with words in angle brackets.

💡 Learn With Memoon

What is HTML? Every web page is a text file written in HTML, which stands for HyperText Markup Language. HTML was invented by the British scientist Tim Berners-Lee at CERN in Switzerland, as part of his invention of the World Wide Web around 1990.

  • HyperText means text containing hyperlinks, which take you to other pages when you click them.
  • Markup means extra labels added to text to say what each part is: this is a heading, this is a paragraph, this is a picture.

HTML is not a programming language. It has no variables, no loops and no decisions. It is a markup language: it describes the structure of content. The browser (such as Microsoft Edge) reads the HTML and decides how to display it. Displaying the page is called rendering.

Tags and elements. HTML labels are called tags. A tag is a word inside angle brackets. Most tags come in pairs:

<h1>Welcome to Pearlhaven</h1>
PartExampleMeaning
Opening tag<h1>Start of a level-1 heading
ContentWelcome to PearlhavenWhat the reader sees
Closing tag</h1>End of the heading; note the forward slash
ElementThe whole thingOpening tag + content + closing tag

A few elements have no content and no closing tag. They are called empty elements: for example <br> (a line break) and <img> (an image).

Attributes. An attribute gives extra information about an element. It goes inside the opening tag, as a name, an equals sign and a value in quotes:

<a href="https://www.memunictimes.example">Read The Memunic Times</a>

Here href is the attribute name and the web address is its value.

The structure of every web page. Every HTML page follows the same skeleton:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Visit Pearlhaven</title>
</head>
<body>
    <h1>Welcome to Pearlhaven</h1>
    <p>A city of coral under the Data Sea.</p>
</body>
</html>
LineWhat it does
<!DOCTYPE html>Tells the browser this is a modern HTML page
<html lang="en">Starts the page and says it is in English
<head>Information about the page, not shown in the page itself
<meta charset="UTF-8">The page uses UTF-8 Unicode text (Chapter 4), so every script and emoji works
<title>The text shown on the browser tab and in search results
<body>Everything the reader actually sees goes in here

Elements go inside other elements, like boxes inside boxes. This is called nesting. The rule is: close elements in the reverse order you opened them. <p><strong>Hi</strong></p> is correct; <p><strong>Hi</p></strong> is wrong. Indenting nested elements, as above, makes this easy to check.

Text elements.

ElementMeaningExample

<h1> to Headings: h1 is the main title, h2 for sections, <h2>Things to do</h2>

<h6>h3 for sub-sections, down to h6
<p>A paragraph<p>The coral towers glow at night.</p>
<br>A line break inside a paragraphLine one<br>Line two
<hr>A horizontal line between sections<hr>
<strong>Important text, shown in bold<strong>Do not touch the eels.</strong>
<em>Emphasised text, shown in italicsIt is <em>very</em> deep.
<!-- -->A comment: notes the browser ignores<!-- Section 2 starts here -->

Use only one <h1> per page, and use headings in order. Screen readers let blind users jump from heading to heading, so headings must show the real structure of the page, not just make text big. You may also see <b> and <i> for bold and italics. They still work, but <strong> and <em> are preferred because they say why the text is different, not just how it looks.

The browser ignores extra spaces and line breaks in your HTML. However many blank lines you type, a new paragraph only starts at a <p> .

Lists.

<h2>What to bring</h2>
<ul>
    <li>A breathing bubble</li>
    <li>A waterproof notebook</li>
    <li>Good manners for octopuses</li>
</ul>
<h2>How to get there</h2>
<ol>
    <li>Go to the jetty at Riverbend.</li>
    <li>Ask Nimo for a bubble.</li>
    <li>Swim down until you see the lights.</li>
</ol>

<ul> is an unordered list, shown with bullets. <ol> is an ordered list, shown with numbers. Each item is an <li> (list item). An ordered list can use letters or Roman numerals with the type attribute: <ol type="A"> or <ol type="i"> , and can begin at another number with start , for example <ol start="5"> .

Links. The <a> element (anchor) makes a hyperlink. Its href attribute is the address to go to:

<a href="https://www.python.org">Download Python</a>
<a href="festival.html">See photos of the Festival</a>

The first is an absolute link: a full web address. The second is a relative link to another file in the same folder as this page. Adding target="_blank" opens a link in a new tab. Always make link text say where the link goes: "Download Python" is helpful, "click here" is not.

Images. The <img> element shows a picture:

<img src="glow-wall.jpg" alt="A giant glowing rangoli flower in magenta, gold 
and cyan on a dark wall above a coral city" width="400">
AttributeMeaning
srcSource: the image file, or its web address
altAlternative text: a description read aloud by screen readers, and shown if the image cannot load

width (and Size in pixels. Give just one and the browser keeps the right shape height )

If you put the image in the same folder as your HTML file, src is just its file name. File names on the web should have no spaces and should match exactly, including capitals: Glow-Wall.JPG and glow-wall.jpg may not be the same file on a web server.

Writing good alt text. Describe what the picture shows and why it matters, in one sentence. Do not start with "image of" (the screen reader already says it is an image). A purely decorative image, such as a border, should have empty alt text: alt="" , so the screen reader skips it. Good alt text is part of accessibility: making technology usable by everyone, including people with disabilities. In many countries, including India, public websites are expected to meet accessibility guidelines.

Tables. A table is built row by row:

<table>
    <tr>
        <th>Event</th>
        <th>Time</th>
    </tr>
    <tr>
        <td>Glow Wall show</td>
        <td>8 pm</td>
    </tr>
    <tr>
        <td>Tide gate tour</td>
        <td>10 am</td>
    </tr>
</table>

<tr> is a table row. <th> is a header cell, shown in bold. <td> is an ordinary data cell. Tables are for data in rows and columns, such as timetables or results, not for arranging the layout of a page.

Colour and alignment: the old way and the modern way. Some older computer books teach tags such as <font color="red"> , <center> and attributes such as bgcolor and align . These are obsolete: they were removed from HTML years ago, and although many browsers still show them, you should not use them. Modern pages control appearance with CSS (Cascading Style Sheets). You will learn CSS properly in Book 7. For now, you can add small pieces of CSS to any element with the style attribute:

What you wantObsolete way (do not use)Modern way
Red text<font color="red"><p style="color: red;">
Page background colour<body bgcolor="lightblue"><body style="background-color: lightblue;">
Centred heading<center><h1><h1 style="text-align: center;">
Font<font face="Arial"><p style="font-family: Arial;">
Text size<font size="5"><p style="font-size: 24px;">

Colours can be names like teal or coral , or the hex codes you learned in Chapter 4, such as #FF8000 . Several properties can go in one style attribute, separated by semicolons: style="color: white; background-color: #003366;" . Choose colours with strong contrast so the text is easy to read.

Making and viewing your page.

  1. Make a folder called My Website in Documents.
  2. Open Notepad. Type your HTML.
  3. Click File → Save as. Go to your My Website folder. Change Save as type to All files. Type the name index.html (the usual name for a site's home page). Check that Encoding is UTF-8. Click Save.
  4. In File Explorer, double-click index.html . It opens in Microsoft Edge.
  5. Keep both windows open. After each change in Notepad, press Ctrl + S to save, then click on Edge and press F5 to refresh.

If you see your tags printed on the page, or the file opens in Notepad again, the file has probably been saved as index.html.txt . Turn on View → Show → File name extensions in File Explorer (from Book 3) to check.

Websites and the web. A website is a collection of linked web pages, usually with images, stored together. Your pages are on your own computer, so only you can see them. To put a site on the internet, the files must be copied to a web server, as you learned in Book 3. Never put personal information such as your full name, school, address, phone number or photos of yourself on a public web page.

💡 Memoon’s tip: Browsers are forgiving: they try to show a page even with mistakes in it, so a missing closing tag might not look wrong today. Check your code by eye, or paste it into the free checker at validator.w3.org.

Illustration from Byte by Byte Book 6: Chapter 10 – Building Web Pages with HTML

✍️ Try It Yourself

Activity 1: Look inside a real page. Open any web page in Microsoft Edge, for example python.org. Press Ctrl + U to view its source. Use Ctrl + F to search for <h1 , <p , <a href and <img . Do the images have alt text? (Real pages also contain lots of CSS and JavaScript; ignore those for now.)

Activity 2: Your first page. Make the My Website folder and create index.html with the skeleton from this chapter. Change the title and heading to All About Me (use your first name only), and add two paragraphs: one about your hobbies and one about your favourite subject. View it in Edge.

Activity 3: Add structure. Add to your page:

  1. An <h2> heading My Favourite Things followed by an unordered list of at least four items.
  2. An <h2> heading My Morning Routine followed by an ordered list of steps.
  3. A horizontal line between the sections.
  1. One sentence with an important word in <strong> and another with an emphasised word in <em> .

Activity 4: Links and images. Save a picture you have drawn in Paint (or one you have permission to use) into your My Website folder as picture.png . Add it to your page with a width of 300 and good alt text. Then add a link to a website you like, which opens in a new tab.

Activity 5: A second page. Create hobbies.html in the same folder with its own heading and a table of your weekly activities (Day, Activity, Time). Link the two pages together with relative links: index.html should link to hobbies.html , and hobbies.html should have a link back home. You have built a two-page website!

Activity 6: Style it. Using only the style attribute, give your page a background colour, centre the main heading, and change the colour of the <h2> headings using a hex code. Check that the text is still easy to read.

Unplugged: Mark it up. Take a printed page from a magazine or textbook. With a pencil, mark where the <h1> , <h2> , <p> , <ul> and <img> elements would be if it were a web page. Write alt text for every picture.

🎉 Memoon Solves It

Memoon built the page in Notepad, inside the Deep Engine, on a slate that Octavia connected to the Light Bridge cable. She gave it one <h1> : Visit Pearlhaven. Below it came <h2> sections for the city, the Deep Engine and the Festival of Tides, an ordered list explaining how to visit, a table of festival events, and a link to Pip's full article.

For the photo of the Glow Wall, she thought carefully about Old Bramble. Then she wrote:

alt="A giant glowing rangoli flower in magenta, gold and cyan on a dark wall

above a coral city" .

She used a deep sea-blue background with white text, centred the heading with a style attribute, and checked every closing tag twice. Then Octavia sent the files to the server at Snowpeak.

The next morning Pip landed on the jetty in a flurry of feathers. "Every village has seen it! The Riverbend frogs want to visit! Moonbrook is organising swimming lessons!" Behind her, Old Bramble was beaming. "My screen reader read me every heading," he said, "and then it read me a giant glowing rangoli flower in magenta, gold and cyan. I could almost see it."

But that afternoon, visitors started arriving in Pearlhaven, and with them came a new problem. Octavia had to record every visitor's name, home village and visiting day, and her records were scrolls. Lots of scrolls. Within a day, Beautine, who had come to help, was buried in them.

❓ Check Your Knowledge

  1. What does HTML stand for? Is it a programming language? Explain.
  2. Label the parts of this element: <p>The tide is high.</p>
  3. What is an attribute? Give an example.
  4. What is the difference between the <head> and the <body> of a page?
  5. Why should a page use UTF-8?
  6. Write the HTML for an ordered list of three steps for making tea.
  7. What is the difference between an absolute link and a relative link?
  8. Write an <img> element for a file called fish.png , 250 pixels wide, with good alt text.
  9. Why is alt text important? What should a decorative image's alt text be?
  10. What do <tr> , <th> and <td> stand for?
  11. A textbook tells you to write <font color="blue"> . What would you write instead in modern HTML?
  12. Find the three mistakes:
<h1>My Page<h1>
<p>I like <strong>swimming</p></strong>
<img src="me.jpg">
  1. Challenge: Write a complete HTML page for a school club of your choice with a title, a main heading, a paragraph, a list of activities, a table of meeting times, an image with alt text and a link to another page.

📚 Word Bank

  • HTML: HyperText Markup Language, used to write web pages.
  • Markup language: a language that labels the parts of a document; it does not give instructions like a programming language.
  • Hyperlink: clickable text or an image that takes you to another page.
  • Browser: a program that requests web pages and displays them, such as Microsoft Edge.
  • Render: to display a web page from its HTML.
  • Tag: an HTML label in angle brackets, such as <p> .
  • Element: an opening tag, its content and its closing tag.
  • Empty element: an element with no content and no closing tag, such as <br> .
  • Attribute: extra information inside an opening tag, such as href or alt .
  • Nesting: placing elements inside other elements.
  • Unordered list: a bulleted list made with <ul> .
  • Ordered list: a numbered list made with <ol> .
  • Absolute link: a link using a full web address.
  • Relative link: a link to a file in relation to the current page, such as another file in the same folder.
  • Alt text: a text description of an image for people who cannot see it.
  • Accessibility: designing technology so that everyone, including people with disabilities, can use it.
  • CSS: Cascading Style Sheets, the language that controls how web pages look.
  • Obsolete: removed from use; old HTML tags such as <font> are obsolete.
  • Website: a collection of linked web pages.
  • Web server: a computer that stores websites and sends pages to browsers.

Keep learning with Byte by Byte

Explore Book 6: Python, Data and How Computers Work. Find the ebook, purchase details and teaching slides on MemuniCity.

Watch this chapter on YouTube

Comments

Popular posts from this blog

CA-7 Job Status and Failure Reason Codes

Here are the various status codes that You may see for jobs in the Queue or Logs in CA-7. R-C0002 R-C0003 R-C0099 R-C0255 R-JCLER A-U0002 A-U0004 A-U0015 A-U0043 A-U4095 A-SOC7 A-U4000 Reason Code/Job Status Code explanation: The indication of the job's current disposition. Values and their meanings are: A-Snnnn-- The job has failed with a system abend. A-Unnnn --The job has failed with a user abend. C-Cnnnn --The job has completed successfully and is going through completion processing. E-ARFATT-- An error occurred during the attempt to attach ARF definitions. This can result if the ARFSET specified is not defined. A diagnostic message may have been written to the CA-7 log, the OS console, or to the trailer queue for the job (in which case it can be displayed using LQ,JOB=x,LIST=ALL). E-ARFERR ---The job encountered an error in the ARF processing. Do a LARFQ command for the job to get more specific information. E-SEGERR --The job has been requeued...

Whistling Winds and Waterfalls: 4 Days of Magic in Shillong

Nestled in the clouds, where the scent of pine trees mingles with the rhythm of waterfalls and the tunes of local guitar-strumming youth—Shillong is more than a place. It’s a vibe. If you’ve got 3 nights and 4 days, you’ve got just enough time to fall in love. Here’s how to make the most of it—food, fun, fog and fantastic views included. Day 1: Shillong, We’re Coming for You! You land in Guwahati, barely out of the airport when the hills start calling. You hop into your cab, Spotify on, windows down, and the three-hour ride to Shillong begins. Just when you think it can’t get better, you stop at Umiam Lake —a lake so calm, it looks like someone ironed the water. By evening, you’re sipping hot chai in Laitumkhrah, maybe nibbling on spicy momos or pork jadoh from a roadside stall. You’re checked into your charming hotel ( Tripura Castle if you fancy old-world royalty, Ri Kynjai if you’re into lakeside poetry). The breeze whispers secrets of waterfalls and pine forests. Sleep well, drea...

Installing and Configuring Hadoop on Ubuntu as a Pseudo Distributed Single Node Cluster

Briefly what is psuedo-distributed single node Hadoop cluster: It is a Hadoop distributed cluster having Single Node. All the five daemons (NN,DN,JT,TT,SNN) are running as individual JVM (java process) instances. We will get all distributed features of Hadoop. This mode is used to develop, test, and staging (before production) Map Reduce programs quickly. It writes all the system, daemon and user logs to different files on the cluster To install Hadoop in this mode, we have to modify the hadoop-env.sh, core-site.xml, hdfs-site.xml, mapred-site.xml. hadoop-env.sh contains all the Environment variables which are required for running Hadoop. All the default values are fine, Only we have to modify the JAVA_HOME=“The location of Java Home Directory” Core-site.xml contains all the cluster specific information like io, temp directory, sorting, file system uri etc. Hdfs-site.xml contains all the parameters which are specific to HDFS like name node directory, data node directory...