COMP321 Midterm Handouts
COMP321 Midterm Handouts
What is CSS?
• CSS stands for Cascading Style Sheets
• CSS describes how HTML elements are to be displayed
CSS Introduction on screen, paper, or in other media
• CSS saves a lot of work. It can control the layout of
CSS is the language we use to style a Web page. multiple web pages all at once
• External stylesheets are stored in CSS files
1 2
CSS Syntax
• A CSS rule consists of a selector and a declaration block.
3 4
23/02/2024
• p is a selector in CSS (it points to the HTML element you want to style:
<p>).
• color is a property, and red is the property value
• text-align is a property, and center is the property value
5 6
7 8
23/02/2024
9 10
11 12
23/02/2024
13 14
15 16
23/02/2024
17 18
19 20
23/02/2024
21 22
23 24
23/02/2024
25 26
27 28
23/02/2024
29 30
31 32
23/02/2024
Specify that the background image should scroll with the rest of the page:
33 34
• Instead of writing:
35 36
23/02/2024
It does not matter if one of the property values is missing, as long as the other ones are
in this order. Note that we do not use the background-attachment property in the
examples above, as it does not have a value.
37 38
39 40
23/02/2024
41 42
43 44
23/02/2024
45 46
47 48
23/02/2024
49 50
51 52
23/02/2024
53 54