You can do this with pure css if you want. The following is an example.
CSS
body { font-family: Helvetica, Arial, sans-serif; } a { text-decoration: none; } .modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 10000; -webkit-transition: opacity 500ms ease-in; -moz-transition: opacity 500ms ease-in; transition: opacity 500ms ease-in; opacity: 0; pointer-events: none; } .modal:target { opacity: 1; pointer-events: auto; } .modal > div { width: 500px; background: #fff; position: relative; margin: 10% auto; -webkit-animation: minimise 500ms linear; -moz-animation: minimise 500ms linear; animation: minimise 500ms linear; padding: 30px; border-radius: 7px; box-shadow: 0 3px 20px rgba(0,0,0,0.9); background: #fff; background: -moz-linear-gradient(#fff, #ccc); background: -webkit-linear-gradient(#fff, #ccc); background: -o-linear-gradient(#fff, #ccc); background: linear-gradient(#fff, #ccc); text-shadow: 0 1px 0 #fff; } .modal:target > div { -webkit-animation-name: bounce; -moz-animation-name: bounce; animation-name: bounce; } .modal h2 { font-size: 36px; padding: 0 0 20px; } @-webkit-keyframes bounce { 0% { -webkit-transform: scale3d(0.1,0.1,1); box-shadow: 0 3px 20px rgba(0,0,0,0.9); } 55% { -webkit-transform: scale3d(1.08,1.08,1); box-shadow: 0 10px 20px rgba(0,0,0,0); } 75% { -webkit-transform: scale3d(0.95,0.95,1); box-shadow: 0 0 20px rgba(0,0,0,0.9); } 100% { -webkit-transform: scale3d(1,1,1); box-shadow: 0 3px 20px rgba(0,0,0,0.9); } } @-webkit-keyframes minimise { 0% { -webkit-transform: scale3d(1,1,1); } 100% { -webkit-transform: scale3d(0.1,0.1,1); } } @-moz-keyframes bounce { 0% { -moz-transform: scale3d(0.1,0.1,1); box-shadow: 0 3px 20px rgba(0,0,0,0.9); } 55% { -moz-transform: scale3d(1.08,1.08,1); box-shadow: 0 10px 20px rgba(0,0,0,0); } 75% { -moz-transform: scale3d(0.95,0.95,1); box-shadow: 0 0 20px rgba(0,0,0,0.9); } 100% { -moz-transform: scale3d(1,1,1); box-shadow: 0 3px 20px rgba(0,0,0,0.9); } } @-moz-keyframes minimise { 0% { -moz-transform: scale3d(1,1,1); } 100% { -moz-transform: scale3d(0.1,0.1,1); } } @keyframes bounce { 0% { transform: scale3d(0.1,0.1,1); box-shadow: 0 3px 20px rgba(0,0,0,0.9); } 55% { transform: scale3d(1.08,1.08,1); box-shadow: 0 10px 20px rgba(0,0,0,0); } 75% { transform: scale3d(0.95,0.95,1); box-shadow: 0 0 20px rgba(0,0,0,0.9); } 100% { transform: scale3d(1,1,1); box-shadow: 0 3px 20px rgba(0,0,0,0.9); } } @keyframes minimise { 0% { transform: scale3d(1,1,1); } 100% { transform: scale3d(0.1,0.1,1); } } .modal a[href="#close"] { position: absolute; right: 0; top: 0; color: transparent; } .modal a[href="#close"]:focus { outline: none; } .modal a[href="#close"]:after { content: 'X'; display: block; position: absolute; right: -10px; top: -10px; width: 1.5em; padding: 1px 1px 1px 2px; text-decoration: none; text-shadow: none; text-align: center; font-weight: bold; background: #000; color: #fff; border: 3px solid #fff; border-radius: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.5); } .modal a[href="#close"]:focus:after, .modal a[href="#close"]:hover:after { -webkit-transform: scale(1.1,1.1); -moz-transform: scale(1.1,1.1); transform: scale(1.1,1.1); } .modal a[href="#close"]:focus:after { outline: 1px solid #000; } a.openModal { margin: 1em auto; display: block; width: 200px; background: #ccc; text-align: center; padding: 10px; border-radius: 7px; background: #fff; background: -moz-linear-gradient(#fff, #ddd); background: -webkit-linear-gradient(#fff, #ddd); background: -o-linear-gradient(#fff, #ddd); background: linear-gradient(#fff, #ddd); text-shadow: 0 1px 0 #fff; border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 1px 1px rgba(0,0,0,0.3); } a.openModal:hover, a.openModal:focus { background: -moz-linear-gradient(#fff, #ccc); background: -webkit-linear-gradient(#fff, #ccc); background: -o-linear-gradient(#fff, #ccc); background: linear-gradient(#fff, #ccc); }
HTML
<aside id="example" class="modal"> <div> <h2>Modal box</h2> <a href="#close" title="Close">Close</a> </div> </aside> <a href="#example" class="openModal">Open</a>