CSS - Puro Css Compatible Modal

 
Vista:
Imágen de perfil de ScriptShow
Val: 571
Plata
Ha mantenido su posición en CSS (en relación al último mes)
Gráfica de CSS

Puro Css Compatible Modal

Publicado por ScriptShow (125 intervenciones) el 06/06/2020 22:40:48
Saludos,

se pueden recrear efectos de lo más variado con CSS. No es el caso; sólo vamos a ver un Modal sencillo, adaptable, compatible...

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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Puro CSS Modal</title>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
.modal {
top: 0px;
left: 0px;
width: 100%;
height: 0px;
position: fixed;
overflow: hidden;
background: dodgerblue;
-webkit-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.cont {
top: 50%;
width: 100%;
font-size: 2em;
color: #FFFFFF;
position: absolute;
text-align: center;
font-family: sans-serif;
}
input {
top: 44%;
left: 40%;
border: 0px;
font-size: 2em;
position: fixed;
cursor: pointer;
color: dodgerblue;
background: transparent;
font-family: sans-serif;
text-transform: uppercase;
}
input:focus + .modal {
width: 100%;
height: 100%;
outline: none;
position: fixed;
z-index: 4;
}
</style>
</head>
<body>
<input type='button' value='Haz Click'>
<div class='modal'>
<div class='cont'>Puro CSS Compatible Modal</div>
</div>
</body>
</html>

P.D.: Es una capa sólida, a la que se le puede añadir opacidad si fuese necesario.

Espero sea útil.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder