Harvard Extension School
CSCI E-12 Fundamentals of Web Site Development
| Spring 2021
Table of Contents
Session 05 - CSS and Layouts
Examples
Example 5.1 - Background Color
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
rgb(100%,66%,33%)
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
#ffa854
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
rgb(255,168,84)
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
hsl(29,100%,66%)
Example 5.2 - Flex
1
2
3
4
5
#f1container { display: flex; } .box { padding: 2em; border: medium solid black; width: 3em; } .box1, .box2, .box3, .box4, .box5 { flex-grow: 0; flex-shrink: 0; flex-basis: 5em; } .box1 { background-color: lightpink;} .box2 { background-color: lightsteelblue;} .box3 { background-color: wheat;} .box4 { background-color: plum;} .box5 { background-color: palegreen;}
Example 5.3 - Flex
1
2
3
.box { padding: 2em; border: medium solid black; width: 3em; } #f1container { display: flex; } .box1 { flex-basis: 15%; } .box2 { flex-basis: 25%; } .box3 { flex-basis: 50%; } .box1 { background-color: lightpink;} .box2 { background-color: lightsteelblue;} .box3 { background-color: wheat;} .box4 { background-color: plum;} .box5 { background-color: palegreen;}
Example 5.4 - Flex
1
2
3
.box { padding: 2em; border: medium solid black; width: 3em; } #f1container { display: flex; } .box1 { flex-grow: 1; flex-shrink: 1; flex-basis: 200px; } .box2 { flex-grow: 1; flex-shrink: 1; flex-basis: 100px; } .box3 { flex-grow: 1; flex-shrink: 1; flex-basis: 500px; } .box1 { background-color: lightpink;} .box2 { background-color: lightsteelblue;} .box3 { background-color: wheat;} .box4 { background-color: plum;} .box5 { background-color: palegreen;}
Table of Contents