Skip to content

Commit 2effe7f

Browse files
committed
add video background
1 parent 1a71d48 commit 2effe7f

File tree

4 files changed

+260
-0
lines changed

4 files changed

+260
-0
lines changed

51-video background/index.html

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="stylesheet" href="style.css" />
7+
<title>Travel Landing Page</title>
8+
</head>
9+
<body>
10+
<section class="showcase">
11+
<header>
12+
<h2 class="logo">Travel</h2>
13+
<div class="toggle"></div>
14+
</header>
15+
<video
16+
src="https://traversymedia.com/downloads/videos/explore.mp4"
17+
muted
18+
loop
19+
autoplay
20+
></video>
21+
<!-- Video Source -->
22+
<!-- https://www.pexels.com/video/aerial-view-of-beautiful-resort-2169880/ -->
23+
<div class="overlay"></div>
24+
<div class="text">
25+
<h2>Never Stop</h2>
26+
<h3>Exploring The World</h3>
27+
<p>
28+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias animi
29+
provident unde illum fuga culpa enim eos amet ullam explicabo.
30+
</p>
31+
<a href="#">Explore</a>
32+
</div>
33+
<ul class="social">
34+
<li>
35+
<a href="#"><img src="https://i.ibb.co/x7P24fL/facebook.png" /></a>
36+
</li>
37+
<li>
38+
<a href="#"><img src="https://i.ibb.co/Wnxq2Nq/twitter.png" /></a>
39+
</li>
40+
<li>
41+
<a href="#"><img src="https://i.ibb.co/ySwtH4B/instagram.png" /></a>
42+
</li>
43+
</ul>
44+
</section>
45+
<div class="menu">
46+
<ul>
47+
<li><a href="#">Home</a></li>
48+
<li><a href="#">News</a></li>
49+
<li><a href="#">Destination</a></li>
50+
<li><a href="#">Blog</a></li>
51+
<li><a href="#">Contact</a></li>
52+
</ul>
53+
</div>
54+
<script src="script.js"></script>
55+
</body>
56+
</html>

51-video background/script.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const menuToggle = document.querySelector(".toggle");
2+
const showcase = document.querySelector(".showcase");
3+
4+
menuToggle.addEventListener("click", () => {
5+
menuToggle.classList.toggle("active");
6+
showcase.classList.toggle("active");
7+
});

51-video background/style.css

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
@import url("https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");
2+
3+
:root {
4+
--overlay-color: #03a9f4;
5+
}
6+
7+
* {
8+
margin: 0;
9+
padding: 0;
10+
box-sizing: border-box;
11+
font-family: "Poppins", sans-serif;
12+
}
13+
14+
.showcase {
15+
position: absolute;
16+
right: 0;
17+
width: 100%;
18+
min-height: 100vh;
19+
padding: 100px;
20+
display: flex;
21+
justify-content: space-between;
22+
align-items: center;
23+
background: #111;
24+
color: #fff;
25+
transition: 0.5s;
26+
z-index: 2;
27+
}
28+
29+
.showcase.active {
30+
right: 300px;
31+
}
32+
33+
.showcase header {
34+
position: absolute;
35+
top: 0;
36+
left: 0;
37+
width: 100%;
38+
padding: 40px 100px;
39+
z-index: 1000;
40+
display: flex;
41+
justify-content: space-between;
42+
align-items: center;
43+
}
44+
45+
.logo {
46+
text-transform: uppercase;
47+
cursor: pointer;
48+
}
49+
50+
.toggle {
51+
position: relative;
52+
width: 60px;
53+
height: 60px;
54+
background: url(https://i.ibb.co/HrfVRcx/menu.png);
55+
background-repeat: no-repeat;
56+
background-size: 30px;
57+
background-position: center;
58+
cursor: pointer;
59+
}
60+
61+
.toggle.active {
62+
background: url(https://i.ibb.co/rt3HybH/close.png);
63+
background-repeat: no-repeat;
64+
background-size: 25px;
65+
background-position: center;
66+
cursor: pointer;
67+
}
68+
69+
.showcase video {
70+
position: absolute;
71+
top: 0;
72+
left: 0;
73+
width: 100%;
74+
min-height: 100vh;
75+
object-fit: cover;
76+
opacity: 0.8;
77+
}
78+
79+
.overlay {
80+
position: absolute;
81+
top: 0;
82+
left: 0;
83+
width: 100%;
84+
height: 100%;
85+
background: var(--overlay-color);
86+
mix-blend-mode: overlay;
87+
}
88+
89+
.text {
90+
position: relative;
91+
z-index: 10;
92+
}
93+
94+
.text h2 {
95+
font-size: 5em;
96+
font-weight: 800;
97+
line-height: 1em;
98+
text-transform: uppercase;
99+
}
100+
101+
.text h3 {
102+
font-size: 4em;
103+
font-weight: 700;
104+
line-height: 1em;
105+
text-transform: uppercase;
106+
}
107+
108+
.text p {
109+
font-size: 1.1em;
110+
font-weight: 400;
111+
margin: 20px 0;
112+
max-width: 700px;
113+
}
114+
115+
.text a {
116+
display: inline-block;
117+
font-size: 1em;
118+
background: #fff;
119+
padding: 10px 30px;
120+
text-decoration: none;
121+
color: #111;
122+
margin-top: 10px;
123+
text-transform: uppercase;
124+
letter-spacing: 2px;
125+
transition: 0.2s;
126+
}
127+
128+
.text a:hover {
129+
letter-spacing: 6px;
130+
}
131+
132+
.social {
133+
position: absolute;
134+
bottom: 20px;
135+
z-index: 10;
136+
display: flex;
137+
justify-content: center;
138+
align-items: center;
139+
}
140+
141+
.social li {
142+
list-style: none;
143+
}
144+
145+
.social li a {
146+
display: inline-block;
147+
filter: invert(1);
148+
margin-right: 20px;
149+
transform: scale(0.5);
150+
transition: 0.5s;
151+
}
152+
153+
.social li a:hover {
154+
transform: scale(0.5) translateY(-15px);
155+
}
156+
157+
.menu {
158+
position: absolute;
159+
top: 0;
160+
right: 0;
161+
width: 300px;
162+
height: 100%;
163+
display: flex;
164+
align-items: center;
165+
justify-content: center;
166+
}
167+
168+
.menu ul {
169+
position: relative;
170+
list-style: none;
171+
}
172+
173+
.menu ul li a {
174+
text-decoration: none;
175+
font-size: 24px;
176+
color: #111;
177+
}
178+
179+
.menu ul li a:hover {
180+
color: var(--overlay-color);
181+
}
182+
183+
@media (max-width: 800px) {
184+
.showcase,
185+
.showcase header {
186+
padding: 40px;
187+
}
188+
189+
.text h2 {
190+
font-size: 3em;
191+
}
192+
193+
.text h3 {
194+
font-size: 2em;
195+
}
196+
}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@
5656
| 48 | [Random Image Feed](https://github.com/solygambas/html-css-fifty-projects/tree/master/48-random%20image%20generator) | [Live Demo](https://codepen.io/solygambas/full/eYdaJQx) |
5757
| 49 | [Todo List](https://github.com/solygambas/html-css-fifty-projects/tree/master/49-todo%20list) | [Live Demo](https://codepen.io/solygambas/full/eYdaJoo) |
5858
| 50 | [Insect Catch Game](https://github.com/solygambas/html-css-fifty-projects/tree/master/50-insect%20catch%20game) | [Live Demo](https://codepen.io/solygambas/full/oNzRbKx) |
59+
| 51 | [Video Background](https://github.com/solygambas/html-css-fifty-projects/tree/master/51-video%20background) | [Live Demo](https://codepen.io/solygambas/full/oNYNLwL) |
5960

6061
Based on [50 Projects In 50 Days - HTML, CSS & JavaScript](https://www.udemy.com/course/50-projects-50-days/) by Brad Traversy (2020).

0 commit comments

Comments
 (0)