I have two modal windows created with CSS only
Even though they are hidden, they make space between the HTML, the title of the page and the condo:
TITULO
-
-
-
-
-
-
-
-
-
CONTENIDO
Here's the HTML:
<div id="ocultar">
<div class="modal-wrapper" id="popup1">
<div class="popup-contenedor">
<h2>Circunstancias Atenuantes</h2>
<?php
listaAtenuantes();
?>
<a class="popup-cerrar" onclick="verificar();" href="#">ACEPTAR</a>
</div>
</div>
<div class="modal-wrapper" id="popup2">
<div class="popup-contenedor">
<h2>Circunstancias Agravantes</h2>
<?php
listaAgravantes();
?>
<a class="popup-cerrar" onclick="verificar();" href="#">ACEPTAR</a>
</div>
</div>
</div>
Here the CSS:
#popup1 {
visibility: hidden;
opacity: 0;
margin-top: -300px;
}
#popup2 {
visibility: hidden;
opacity: 0;
margin-top: -300px;
}
#popup1:target {
visibility:visible;
opacity: 1;
background-color: rgba(0,0,0,0.8);
position: fixed;
top:0;
left:0;
right:0;
bottom:0;
margin:0;
z-index: 999;
-webkit-transition:all 1s;
-moz-transition:all 1s;
transition:all 1s;
}
#popup2:target {
visibility:visible;
opacity: 1;
background-color: rgba(0,0,0,0.8);
position: fixed;
top:0;
left:0;
right:0;
bottom:0;
margin:0;
z-index: 999;
-webkit-transition:all 1s;
-moz-transition:all 1s;
transition:all 1s;
}
.popup-contenedor {
position: relative;
margin:7% auto;
padding:30px 50px;
background-color: #fafafa;
color:#333;
border-radius: 3px;
width:50%;
}
a.popup-cerrar {
position: absolute;
top:3px;
right:3px;
background-color: #333;
padding:7px 10px;
font-size: 20px;
text-decoration: none;
line-height: 1;
color:#fff;
}
How can I prevent them from making so much space?
MODIFIED CSS
#popup1 {
display: none;
opacity: 0;
margin-top: -300px;
}
#popup2 {
display: none;
opacity: 0;
margin-top: -300px;
}
#popup1:target {
display: block;
opacity: 1;
background-color: rgba(0,0,0,0.8);
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:0;
z-index: 999;
-webkit-transition:all 1s;
-moz-transition:all 1s;
transition:all 1s;
}
#popup2:target {
display: block;
opacity: 1;
background-color: rgba(0,0,0,0.8);
position: absolute;
top:0;
left:0;
right:0;
bottom:0;
margin:0;
z-index: 999;
-webkit-transition:all 1s;
-moz-transition:all 1s;
transition:all 1s;
}
.popup-contenedor {
position: absolute;
margin:7% auto;
padding:30px 50px;
background-color: #fafafa;
color:#333;
border-radius: 3px;
width:50%;
}
a.popup-cerrar {
position: absolute;
top:3px;
right:3px;
background-color: #333;
padding:7px 10px;
font-size: 20px;
text-decoration: none;
line-height: 1;
color:#fff;
}
They do not make space anymore, but when they show up they stick to the left, not centered