In: Computer Science
Overview
Students will learn how to use block-level <div> elements in HTML and style them with CSS to transform them using various properties such as:
Related Lecture(s)
Basic Content
https://www.youtube.com/watch?v=Rv1bKo3SskY&feature=emb_logo
Heirarchy of folder:
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<main>
<div>
<div class="h1">
<div class="hw">
</div>
</div>
<div>
<div class="sq"></div>
</div>
</div>
</main>
</body>
</html>
style.css:
body {
background-color: #fff;
margin: auto;
padding: 50px;
}
.h1 {
height: 20vh;
width: 20vw;
margin: 0 auto;
position: relative;
background-color: black;
z-index: 1000;
}
.h1:before {
content: " ";
display: block;
width: 100%;
height: 20%;
background-color: #95296b;
transform: perspective(15px) rotateX(2deg) scalex(1.2);
position: absolute;
top: 0px;
border: 0;
z-index: 10001;
}
.h1:after {
content: " ";
display: block;
width: 100%;
height: 10%;
background-color: blue;
position: absolute;
bottom: 0px;
border: 0;
transform: scalex(1.3);
}
.h1 .hw {
position: absolute;
display: block;
height: 40%;
width: 20%;
background-color: #fff;
bottom: 10%;
left: 40%;
}
.h1 .hw:before {
content: " ";
height: 100%;
width: 100%;
background-color: #fff;
display: block;
position: absolute;
right: 150%;
transform: scaley(0.4);
}
.h1 .hw:after {
content: " ";
height: 100%;
width: 100%;
background-color: white;
display: block;
position: absolute;
left: 150%;
transform: scaley(0.4);
}
.body {
background-color: #f7f7f7;
margin: 0;
padding: 20px;
}
.house {
height: 80vh;
width: 80vw;
margin: 0 auto;
position: relative;
background-image: radial-gradient(circle at 0% 100%, rgba(99, 41, 147, 0.9), rgba(149, 41, 107, 0.6), rgba(9, 141, 147, 0.9), rgba(49, 11, 147, 0.2));
z-index: 998;
}
.house:before {
content: " ";
display: block;
width: 100%;
height: 25%;
background-image: repeating-linear-gradient(90deg, #000, #fff 7%, #000 10%);
transform: perspective(10px) rotateX(1deg) scalex(1.1);
position: absolute;
top: 0px;
border: 0;
z-index: 999;
}
.house:after {
content: " ";
display: block;
width: 100%;
height: 10%;
background-image: radial-gradient(circle at 0% 100%, #632993, #95296b, #098d93, #310b93);
position: absolute;
bottom: 0px;
border: 0;
transform: scalex(1.2);
}
.house .door-window {
position: absolute;
display: block;
height: 40%;
width: 20%;
background: radial-gradient(white, #949699);
background-color: #fff;
bottom: 10%;
left: 40%;
}
.house .door-window:before {
content: " ";
height: 100%;
width: 100%;
background: radial-gradient(white, #949699);
background-color: #fff;
display: block;
position: absolute;
right: 150%;
transform: scaley(0.5);
}
.house .door-window:after {
content: " ";
height: 100%;
width: 100%;
background: radial-gradient(white, #949699);
display: block;
position: absolute;
left: 150%;
transform: scaley(0.5);
}
.sq{
margin: auto;
margin-top: 5%;
border: 10px solid green;
padding: 5%;
width: 20%;
height: 20%;
}