Professional Documents
Culture Documents
Department of Education
REGION I
SCHOOLS DIVISION OF PANGASINAN I
Computer
12
Programming
(.Net Technology)
Quarter 1 (Week 5) –
Module 1:
LC: Create HTML5 document
using advanced techniques
with JavaScript and CSS3
Prepared by:
ISHTAR C. FORTES
TEACHER II
I. Objectives
1. Identify CSS Color coding schemes.
2. Apply CSS Border in HTML document.
3. Create a CSS Code block to determine match with the output.
III. Discussion
This module focuses on the application of Colors, Background and Borders
using CSS 3
There is an extension RGB coloring scheme which uses Alpha. Alpha defines
the opacity or transparency of color being used. The values for alpha are from 0.0 (full
transparent) to 1.0 (not transparent) depending on the desired transparency.
Another coloring scheme is with the use of Hexadecimal number system or Hex
and specified using the form of #rrggbb. Since hexadecimal is different on decimal
which we are using every day. Hexadecimal is a number system which uses the
Dec 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F
The hex form is #rrggbb, where rr (red), gg (green) and bb (blue) are
hexadecimal values between 00 and ff. To display red using hex, we may use #ff0000.
Red is set to its highest value (ff) and the other two (green and blue) are set to 0. To
display green, we may use #00ff00 and #0000ff for blue. For using hex to display
black, we may use #000000 and #ffffff for white. Here are some examples of colors
using hex.
For displaying the different shades of gray using hex, the value of the 3
parameters must be all equal.
The last coloring coding scheme is HSL (Hue, Saturation and Lightness). HSL
uses the format of hsl(0,100%,50%). The first parameter hue represents the color
wherein 0 is red, 120 is green and 240 is blue. The second parameter saturation uses
Here are also the variations of adjusting the lightness of an HSL color-coding
scheme.
Here are other examples of adjusting the saturation with the same value of
hue and lightness.
To display the different shades of gray, the hue and saturation must be set to
zero and adjust the lightness from 0% to 100% to get the desired shade of gray.
CSS Backgrounds
On the next part of this module, we will also discuss the different properties that
we may use in changing the background of our website using different properties.
Backgrounds such as plain colors, gradient colors and even images as background
are possible.
There are 2 ways on how we can apply the opacity of colors in background.
One is with the use alpha in RGB and HSL color combination and the other one is
adding an opacity property after the background property. The value of opacity ranges
from 1 to 0.0. The value of 1 means no opacity property applied and when the value
decreases the opacity will also increase.
body {
background-image: url("paper.gif");
}
Background
repeat Code Description
Value
body { Background
background-image: url("paper.gif"); image will be
repeat-x
background-repeat: repeat-x; repeated
} horizontally
body { Background
background-image: url("paper.gif"); image will be
repeat-x
background-repeat: repeat-y; repeated
} vertically
body { Background
background-image: url("paper.gif"); image will
repeat-
background-repeat: repeat-repeat; repeat
repeat
} horizontally
and vertically
body { Background
background-image: url("paper.gif"); image will
No-repeat
background-repeat: no-repeat; not be
} repeated
Next property of background is with the use of position. There are several possible
positions of image and its corresponding value.
Value Description
left top If you only specify one keyword, the other value will be
left center "center"
left bottom
right top
CSS Borders
Now with the use of borders, we can enclose certain elements within boxes.
The first sub property of CSS border is width, which will specify the width of 4 borders.
Code Description
p.one { The assignment of values for border-
border-style: solid; width uses pixels.
border-width: 5px;
}
Border styles also differs. Values can be dashed, solid, groove, inset, outset,
dotted, and double. The code below uses a double style which makes the border
doubled and border width to adjust its size.
p.one {
border-style: double;
border-width: 20px;
width: 250px;
The color of borders can also be set at once and can also be set manually on
each side. Assigning a value of the color can be set using the name of the color,
RGB, Hex, and HSL. Alpha or transparency can also be applied.
p.once {
border-style: double;
border-width: 20px;
width: 250px;
border-color: blue
p.manual {
border-style: solid;
border-color: red green blue yellow;
We can also manually assign different styles of border on each side. Refer to
the codes below.
p.one {
border-width: 20px;
width: 250px;
border-top-style: dotted;
border-right-style: double;
border-bottom-style: groove;
border-left-style: solid;
The last property of border is radius. Radius is used to add a smooth rounded
corner of borders.
p.one {
border-style: double;
border-width: 20px;
width: 250px;
border-radius: 15px;
border-color: green;
A. RGB C. Hex
B. CMYK D. HSL
_________ 2. Which of the following CSS codes assigns a green background color
of an element?
A.
body {
background-color: rgb(0,255,0)
}
B.
body {
background-color: rgb(255,0,0)
}
C.
body {
background-color: rgb(0,0,255)
}
D.
body {
background-color: rgb(255,255,255)
}
p.one {
border-width: 20px;
width: 250px;
border-top-style: ________;
border-_______-style: solid;
border-bottom-style: ________;
border-left-style: solid;
OUTPUT