This time, I'll include the code (as I've been asked previously). The problem is that, even when this code does what I need (a CSS modal/lightbox window), I can't get it to animate neither the top nor the translate properties. I think it's a problem of positioning, because, the original example used no position for the container but, instead, used the :before pseudo-element (I don't like it). What's wrong with this code.
<!DOCTYPE html> <html> <head> <meta charset="iso-8859-1" /> <title>Pure CSS Modal Window</title> <style> * { margin: 0px; padding: 0px; } .modal-container { position: fixed; display: none; top: 0px; left: 0px; right: 0px; bottom: 0px; background-color: rgba(0, 0, 0, 0.75); } .modal-content { position: absolute; top: -100%; left: 50%; width: 70%; max-width: 400px; max-height: 400px; transform: translateX(-50%); background-color: #fff; padding: 20px; border-radius: 10px; overflow-y: auto; transition: all 5s; } .modal-container:target { display: block; } .modal-container:target .modal-content { top: 50%; transform: translate(-50%, -50%); } </style> </head> <body> <a href="#modal1">Modal 1</a> <a href="#modal2">Modal 2</a> <div class="modal-container" id="modal1"> <div class="modal-content"> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <p>This is the content of Modal 1</p> <a href="#modal-close">Close</a> </div> </div> <div class="modal-container" id="modal2"> <div class="modal-content"> <p>This is the content of Modal 2</p> <a href="#modal-close">Close</a> </div> </div> </body> </html>