☰ Year plan · Communication Technology

CSS: the looks of a web page

Week 9 · Unit 2, Lesson 2 Web Page Format (CSS) · 3 lessons
1

Why keep looks apart from content?

ICT Prep 2 Term 1, Unit 2, Lesson 2: pp. 56–62
GoalExplain why HTML and CSS are kept apart and list the benefits of CSS.
New words
HTML · the language that describes the content of a page, such as headings, paragraphs and picturesCSS · separate rules that say how the page looks: colours, sizes, fonts and spacingbrowser · the program that reads a page and shows it on the screentag · a word in angle brackets, such as the one that marks a heading
Explanation

Remember HTML from earlier years: it describes the content of a page, for example a heading, a paragraph and a picture, and the browser shows it. CSS is a separate set of rules for how the page looks: colours, sizes, fonts and spacing. Think of a recipe. The list of ingredients and the steps are the content. How the dish is served and decorated is the look. If you mix the two, changing the look means rewriting the recipe. Long ago, formatting was written inside HTML, with tags that set the font. For big sites this was slow to change, so a group that sets web standards created CSS, to separate the looks from the content. This brings many benefits, shown in the table.

BenefitWhy
saves timeyou write the look once
faster loadingthe browser keeps one copy of the rules
easy to changeedit once, every page follows
nicer and easier to readdesigns are more careful
content kept apart from designeach can be changed alone
pages adapt to screensCSS helps layouts fit phones and big screens
Worked examples
recipe card = content (HTML)decoration = looks (CSS)
Omar bakes a cake from a recipe card. The card lists the ingredients and steps: that is like HTML. His sister decorates the cake with cream and cherries: that is like CSS. They can change the decoration without changing the card.
A site has a hundred pages. The owner wants every heading to turn from black to blue. With old inline formatting, a hundred pages must be changed. With one CSS rule, one line is changed and all pages follow.
Class activity

Draw a recipe card on one side and a decorated dish on the other. Under them write which is HTML and which is CSS. Then choose two benefits of CSS from the table and explain each in one sentence to a family member.

Practice
1
What does HTML describe?
2
What does CSS describe?
3
Why does CSS make changes easier?
4
Name two benefits of CSS.