- Rutgers Design 2B: W3
- The Box Model
- Positioning with Basic CSS
- Static
- Relative
- Fixed
- Absolute
- Sticky
- Resources
- Flexbox
- flex-direction
- justify-content
- These are the values you can use for justify-content:
- align-items
- the align-items values are as follows:
- align-self
- Resources
- Hover Activity
- Other Cool Code snippets
- Pick 10
- Create a Favicon
Visible to members of this folder
The Box Model
Positioning with Basic CSS
div {
position: sticky;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<h1 class="title">Hello</h1>
<div class="static">
</div>
<div class="relative">
</div>
<div class="absolute">
</div>
<div class="fixed">
</div>
<div class="sticky">
</div>
</body>
</html>
body {
background-color: lavender;
}
div {
width: 500px;
height: 200px;
}
x
div.relative {
background-color: yellow;
position: relative;
}
div.fixed {
background-color: purple;
position: fixed;
}
div.absolute {
background-color: green;
position: absolute;
}
div.sticky {
background-color: red;
position: sticky;
}
Static
Relative
Fixed
Absolute
<div class="relative">
<div class="absolute">
</div>
</div>
Sticky
Flexbox
<!DOCTYPE html>
<html>
<head>
<title>Flexbox Demo</title>
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<div class="container">
<div class="item1">1</div>
<div class="item2">2</div>
<div class="item3">3</div>
</div>
</body>
</html>
.container {
display: flex;
padding:10px;
background-color: seagreen;
min-height: 200px;
}
.container div {
margin: 10px 10px;
width: 100px;
height: 100px;
background-color: bisque;
}
flex-direction
flex-direction: column;
justify-content
.container {
display: flex;
flex-direction: row;
justify-content: flex-start;
background-color: seagreen;
min-height: 200px;
}
justify-content: flex-start;
justify-content: flex-end;
justify-content: center;
justify-content: space-between;
justify-content: space-around;
justify-content: space-evenly;
align-items
align-items: flex-start;
align-items: flex-end;
align-items: center;
align-items: stretch;
align-items: baseline;
.container {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding:10px;
background-color: seagreen;
min-height: 200px;
}
align-self
.item1 {
align-self: flex-end;
}
Hover Activity
Other Cool Code snippets
Pick 10
Create a Favicon
<link rel="icon" type="image/png" href="assets/imgs/favicon.png">