Information Technology Topic
Creating a Simple Web Page
- Read notes
- Flashcards
- Quiz
- Confident
Study focus - 3 things
- A web page is a file, and a web-design package lets you build it by typing and inserting pictures while it writes the page code for you
- Pictures need care: alternative text, tidy file names, a licence that allows reuse, text wrapped round them, and thumbnails scaled in proportion
- The main page of a site is the home page, normally saved as the index file, and every other page hangs off it
Section 1What a web page is and how you build one
A web page is a file. A website is a collection of pages (and the pictures and other files they use) kept together. When a visitor opens a page, their browser reads the file and shows it. You do not have to write the page code by hand. In a web-design package you click on the page, type your text and insert pictures, and the package writes the code behind the scenes. It is still worth knowing what that code looks like. A picture, for example, is a line like this (our own practice example): <img src="images/patty-tray.jpg" alt="A tray of beef patties" width="400" height="300"> Here's the trick: you do not need to memorise tags. Just notice the parts: where the picture file is (src), the words that describe it (alt) and its size (width and height). Those are the same choices the package asks you to make with its dialog boxes.
Section 2Choosing a design before you build
Before you touch the package, decide what the page should look like. Think about the purpose of the site and who will use it, then pick the mood: colours, fonts and the overall look. A bakery in Mandeville wants warm and friendly. A law office wants calm and serious. Sketch the layout roughly on paper first, with boxes for the heading, the text and the pictures. Real web teams do this too before they make a digital version. Gather your written text and pictures before you start, so you are not inventing content while you build. Whether you start from a ready-made design in your package or from a blank page, you are making the same choices. Keep text easy to read against its background, and keep the same look on every page of the site. Watch out: pictures and fonts have licences. Only use pictures you took yourself or whose licence allows reuse, and check the licence on any font you choose.
Section 3Inserting and deleting text and graphics
Editing a web page works like editing a document. To add text, click where it should go and type. To remove it, select it and delete it. To add a graphic, choose the insert-picture command and pick the picture file. To remove one, select it and delete it. When you insert a picture, the package asks for alternative text, often called alt text. This is a short description of the picture in words. It helps people who cannot see the picture, and it shows if the picture fails to load. A picture that is purely decoration, such as a divider line, gets empty alt text because it adds no information. Also set the picture's width and height, so the page does not jump around while the picture loads. Do not put important text inside a picture (such as opening hours): people who cannot see the picture will miss it. And never link straight to a picture sitting on someone else's website without permission. Use your own copy.
Section 4Wrapping text around an image
Left alone, a picture sits on its own and text stops above it and starts again below it. If you set the picture to the left or the right, the text flows round the other side. That is called wrapping text round an image. A photo on the left of a paragraph with the text running down its right side looks tidy and saves space. Add a little space (a margin) around the picture so the text does not touch its edge. One side effect: later content can move up beside the picture too. If a heading should start below the picture instead of squeezing in beside it, you stop the wrap at that point. Easy to mix up: wrapping is about where the text goes, not how big the picture is. Resizing and wrapping are two separate settings.
Section 5Thumbnails
A thumbnail is a small copy of a picture that visitors can click to see the full-size picture. A picture can be turned into a link, so the small copy on the page links to the big one. To make one: save a small copy of the picture, put it on the page, then make it a link to the full-size file. Keep the proportions. If a photo is 1600 pixels wide and 1200 tall and you want a thumbnail 200 wide, the height is 1200 x 200 / 1600 = 150. Shrink the width alone and the picture looks squashed. The saving is large. The original has 1600 x 1200 = 1,920,000 pixels and the thumbnail has 200 x 150 = 30,000, which is 64 times fewer. A gallery page full of small thumbnails opens much faster than one full of big photos. Watch out: typing a small width on a huge picture only changes how it is shown. Visitors still download the huge file. A real thumbnail is a separate small file.
Section 6Home page, index page and tidy files
The home page is the first page visitors see. It is normally saved with the file name index (for example index.html), because the index file is generally recognised as the main page of a site. Keep it in the top folder of the site. Other pages go in the same folder or in folders inside it, and pictures go in a folder of their own, such as images. The home page should lead to the other pages, and each other page should lead back to the home page (links are the next topic). Give files simple names: lowercase, no spaces, hyphens between words. So negril-sunset.jpg is a good name and Negril Sunset.JPG is not. Tidy names are easier to type correctly in a link, and a wrongly typed name is one of the commonest reasons a picture or page fails to appear.
Examples
A Mandeville bakery is building its home page. The best photo is 2400 pixels wide and 1600 pixels tall. (a) The page shows it 600 pixels wide, keeping its proportions. What height is needed? (b) The owner also wants a thumbnail 150 pixels wide that links to the full photo. What height should it be? (c) How many times fewer pixels does the thumbnail have than the original? (d) Name the file the home page should be saved as.
(a) Scale the height by the same fraction as the width: 1600 x 600 / 2400 = 400 pixels, so the picture is 600 by 400. (b) 1600 x 150 / 2400 = 100 pixels, so the thumbnail is 150 by 100. (c) The original has 2400 x 1600 = 3,840,000 pixels and the thumbnail has 150 x 100 = 15,000. 3,840,000 / 15,000 = 256, so the thumbnail has 256 times fewer pixels. (d) The home page is saved as index.html, because the index file is generally recognised as a site's main page. Easy to mix up: the picture is 16 times smaller each way, but 16 x 16 = 256 times fewer pixels overall.
A school in Portmore is building a photo gallery page. The thumbnails must all be 160 pixels wide. The photos are Sports Day 1.JPG (1600 by 1200), Concert Night.JPG (1200 by 1800) and Banner Wide.JPG (2000 by 1000). (a) Work out each thumbnail's height. (b) Which thumbnail is tallest, and how many pixels do the three thumbnails have in total? (c) Rewrite the three file names in the tidy style. (d) Explain why a visitor's browser still needs a separate small file for each thumbnail.
(a) Keep the proportions: 1200 x 160 / 1600 = 120, 1800 x 160 / 1200 = 240 and 1000 x 160 / 2000 = 80. So the thumbnails are 160 by 120, 160 by 240 and 160 by 80. (b) The concert photo is tallest at 240 pixels (it is a portrait photo). The pixels are 160 x 120 = 19,200, 160 x 240 = 38,400 and 160 x 80 = 12,800, a total of 70,400. (c) sports-day-1.jpg, concert-night.jpg and banner-wide.jpg: lowercase, no spaces, hyphens between words. (d) If the page only shows the big file at a small size, the visitor still downloads the whole big file. A separate small file is quick to load, and the thumbnail then links to the big one for anyone who wants it.
Now let's water it
Session runs notes to flashcards to quiz back-to-back.
Where this comes from
- CSEC Information Technology Syllabus (CXC 30/G/SYLL 08, revised 2000, 2008, 2013) · Caribbean Examinations Council (CXC) · Section 6, Specific Objective 25 · Syllabus scope
- MDN Web Docs: Learn web development (various pages) · Mozilla and MDN contributors · Page creating-the-content, MDN HTML: Creating the content, checked against (https://developer.mozilla.org/en-US/docs/Learn_web_development/Getting_started/Your_first_website/Creating_the_content) · Facts
- MDN Web Docs: Learn web development (various pages) · Mozilla and MDN contributors · Page html-images, MDN HTML images, checked against (https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Structuring_content/HTML_images) · Facts
- MDN Web Docs: Learn web development (various pages) · Mozilla and MDN contributors · Page floats, MDN Floats, checked against (https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/CSS_layout/Floats) · Facts
- MDN Web Docs: Learn web development (various pages) · Mozilla and MDN contributors · Page dealing-with-files, MDN Dealing with files, checked against (https://developer.mozilla.org/en-US/docs/Learn_web_development/Getting_started/Environment_setup/Dealing_with_files) · Facts
- MDN Web Docs: Learn web development (various pages) · Mozilla and MDN contributors · Page what-will-your-website-look-like, MDN What will your website look like?, checked against (https://developer.mozilla.org/en-US/docs/Learn_web_development/Getting_started/Your_first_website/What_will_your_website_look_like) · Facts