forked from tiagojorge22102860/Lab4_PW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparalax.html
46 lines (42 loc) · 1.91 KB
/
paralax.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lab4</title>
</head>
<style>
.parallax{
background-image: url(https://images.unsplash.com/photo-1678791589088-f26ed2590a21?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=876&q=80);
min-height: 500px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
@media(max-width:600px){
body{
width: 100vw;
height: 100vh;
}
}
</style>
<body>
<div>
<h1>Parallax</h1>
<p>faça scroll para ver o efeito parallax</p>
<p>A div funciona como uma janela, que demonstra que a imagem esta colada e não é arrastada com o scroll</p>
</div>
<div class="parallax"></div>
<div><p>Este div existe para permitir o scroll</p></div>
<div><h2>Imagens responsivas </h2>
<p>O tamanho da imagem é adaptado ao tamanho do ecrã</p>
<picture>
<source srcset="https://images.unsplash.com/photo-1594495894542-a46cc73e081a?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1471&q=80" media="(max-width: 600px)" width="320px" height="213">
<source srcset="https://images.unsplash.com/photo-1679198488857-d49a6c1d1907?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" media="(max-width: 1500px)">
<source srcset="flowers.jpg">
<img src="https://images.unsplash.com/photo-1679198488857-d49a6c1d1907?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" alt="Pão de forma" style="width:auto;">
</picture></div>
</body>
</html>