sushma_proach

pure css pop up

Jun 28th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.46 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <style>.modal-container{
  7.   position:fixed;
  8.  background-color:#fff;
  9.  border:solid 1px #ccc;
  10.  left:50%;
  11.  transform:translate(-50%, -200%);
  12.   -webkit-transform:translate(-50%, -200%);
  13.    -ms-transform:translate(-50%, -200%);
  14.    padding:20px;
  15.    width:70%;
  16.    max-width:400px;
  17.    
  18.    transition:transform 700ms ease-out;
  19.     -webkit-transition:transform 700ms ease-out;
  20.  
  21. }
  22.  
  23. .modal:before{
  24.   content:"";
  25.   background-color:rgba(0, 0, 0, 0.5);
  26.   display:none;
  27.   position:fixed;
  28.   height:100%;
  29.   left:0;
  30.   top:0;
  31.   width:100%;
  32. }
  33.  
  34.  
  35. .modal:target:before{
  36.   display:block;
  37.  
  38. }
  39.  
  40. .modal:target .modal-container{
  41.   transform:translate(-50%, 0);
  42.   -webkit-transform:translate(-50%, 0);
  43.    -ms-transform:translate(-50%, 0);
  44.  
  45.  
  46. }</style>
  47. </head>
  48.  
  49. <body>
  50. <a href="#popup1" style='color:blue; font-size:16px;'>pop up 1</a>&nbsp;
  51. <a href="#popup2" style='color:blue; font-size:16px;'>pop up 2</a>
  52.  
  53. <div class="modal" id="popup1">
  54. <div class="modal-container">
  55. This is our Pop up 1<br/>
  56. <a href="#">Close</a>
  57. </div>
  58.  
  59. </div>
  60.  
  61. <div class="modal" id="popup2">
  62. <div class="modal-container">
  63. This is our Pop up 2<br/>
  64. <a href="#">Close</a>
  65. </div>
  66.  
  67. </div>
  68. </body>
  69. </html>
Add Comment
Please, Sign In to add comment