-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path06.width-height.css
More file actions
76 lines (69 loc) · 1.52 KB
/
06.width-height.css
File metadata and controls
76 lines (69 loc) · 1.52 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* width y height */
div {
border: 1px solid brown;
box-sizing: border-box;
margin: 10px 0;
/* display: inline-block; */
}
/* ancho y alto fijos: */
.div-1{
width: 300px;
height: 100px;
}
.div-2 {
min-width: 200px;
max-width: 300px;
/* El ancho máximo es 300px */
width: 400px;
min-height: 100px;
max-height: 500px;
/* Aunque se le ponga menos height, min-height nos "asegura"
que el elemento no sea más pequeño que cierto valor: */
height: 50px;
}
.div-3 {
width: 100%;
background-color: lightgrey;
}
.div-4 {
text-align: center;
/* Ancho completo del dispositivo: */
width: 100vw;
background-color: lightgrey;
/* Le pongo una posición absoluta y puedo indicar los px
que debo mover este elemento para alinearlo */
position: absolute;
left: 0;
}
.div-5 {
background-color: rgba(0, 0, 0, 0.5);
color: white;
/* Centrado horizontal y vertical con flex: */
display: flex;
align-items: center;
justify-content: center;
/* Posición a absoluta: */
position: absolute;
/* Quitamos las separaciones y colocamos arriba a la derecha (top right): */
top: 0;
right: 0;
padding: 0;
margin: 0;
/* width: */
width: 20%;
/* Altura máxima del dispositivo */
height: 100vh;
/* z-index */
/* más positivo => más adelante (más fuera de la pantalla) */
/* más negativo => más "atrás" (dentro de la pantalla) */
/* por defecto => 0 */
z-index: -2;
}
.div-6 {
position: absolute;
top: 0;
right: 0;
z-index: -1;
background-color: aqua;
width: 20%;
}