Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. <style id="jsbin-css">
  8. @-webkit-keyframes left {
  9. 0% {
  10. height: 20px;
  11. top: 30px;
  12. }
  13. 30% {
  14. height: 80px;
  15. top: 0;
  16. }
  17. 100% {
  18. height: 100%;
  19. top: 0;
  20. }
  21. }
  22.  
  23. @-webkit-keyframes top {
  24. 100% {
  25. width: 200px;
  26. }
  27. }
  28.  
  29. @-webkit-keyframes bottom {
  30. 100% {
  31. width: 200px;
  32. }
  33. }
  34.  
  35. @-webkit-keyframes right {
  36. 100% {
  37. height: 100%;
  38. }
  39. }
  40.  
  41. #test {
  42. width: 200px;
  43. height: 300px;
  44. background: purple;
  45. position: relative;
  46. }
  47.  
  48. #test .content {
  49. width: calc(100% - 4px);
  50. height: calc(100% - 4px);
  51. display: inline-block;
  52. background: pink;
  53. margin: 2px;
  54. }
  55.  
  56. .border {
  57. display: inline-block;
  58. position: absolute;
  59. background: yellow;
  60. }
  61.  
  62. .left {
  63. width: 2px;
  64. height: 20px;
  65. top: 30px;
  66. left: 0;
  67. }
  68.  
  69. #test:hover .left {
  70. animation: left 1s 1 linear;
  71. -webkit-animation-fill-mode: forwards;
  72. }
  73.  
  74. .top {
  75. width: 0px;
  76. height: 2px;
  77. top: 0;
  78. left: 0;
  79. }
  80.  
  81. #test:hover .top {
  82. animation: top 0.7s 0.3s 1 linear;
  83. -webkit-animation-fill-mode: forwards;
  84. }
  85.  
  86. .right {
  87. width: 2px;
  88. height: 0px;
  89. top: 0;
  90. right: 0;
  91. }
  92.  
  93. #test:hover .right {
  94. animation: right 1s 1s 1 linear;
  95. -webkit-animation-fill-mode: forwards;
  96. }
  97.  
  98. .bottom {
  99. width: 0px;
  100. height: 2px;
  101. bottom: 0;
  102. left: 0;
  103. }
  104.  
  105. #test:hover .bottom {
  106. animation: bottom 1s 1s 1 linear;
  107. -webkit-animation-fill-mode: forwards;
  108. }
  109.  
  110. body {
  111. background: #fff;
  112. }
  113. </style>
  114. </head>
  115. <body>
  116. <div id="test">
  117. <div class="top border"></div>
  118. <div class="left border"></div>
  119. <div class="right border"></div>
  120. <div class="bottom border"></div>
  121. <div class="content"></div>
  122. </div>
  123.  
  124.  
  125. <script id="jsbin-source-css" type="text/css">@-webkit-keyframes left {
  126. 0% {
  127. height: 20px;
  128. top: 30px;
  129. }
  130. 30% {
  131. height: 80px;
  132. top: 0;
  133. }
  134. 100% {
  135. height: 100%;
  136. top: 0;
  137. }
  138. }
  139.  
  140. @-webkit-keyframes top {
  141. 100% {
  142. width: 200px;
  143. }
  144. }
  145.  
  146. @-webkit-keyframes bottom {
  147. 100% {
  148. width: 200px;
  149. }
  150. }
  151.  
  152. @-webkit-keyframes right {
  153. 100% {
  154. height: 100%;
  155. }
  156. }
  157.  
  158. #test {
  159. width: 200px;
  160. height: 300px;
  161. background: purple;
  162. position: relative;
  163. }
  164.  
  165. #test .content {
  166. width: calc(100% - 4px);
  167. height: calc(100% - 4px);
  168. display: inline-block;
  169. background: pink;
  170. margin: 2px;
  171. }
  172.  
  173. .border {
  174. display: inline-block;
  175. position: absolute;
  176. background: yellow;
  177. }
  178.  
  179. .left {
  180. width: 2px;
  181. height: 20px;
  182. top: 30px;
  183. left: 0;
  184. }
  185.  
  186. #test:hover .left {
  187. animation: left 1s 1 linear;
  188. -webkit-animation-fill-mode: forwards;
  189. }
  190.  
  191. .top {
  192. width: 0px;
  193. height: 2px;
  194. top: 0;
  195. left: 0;
  196. }
  197.  
  198. #test:hover .top {
  199. animation: top 0.7s 0.3s 1 linear;
  200. -webkit-animation-fill-mode: forwards;
  201. }
  202.  
  203. .right {
  204. width: 2px;
  205. height: 0px;
  206. top: 0;
  207. right: 0;
  208. }
  209.  
  210. #test:hover .right {
  211. animation: right 1s 1s 1 linear;
  212. -webkit-animation-fill-mode: forwards;
  213. }
  214.  
  215. .bottom {
  216. width: 0px;
  217. height: 2px;
  218. bottom: 0;
  219. left: 0;
  220. }
  221.  
  222. #test:hover .bottom {
  223. animation: bottom 1s 1s 1 linear;
  224. -webkit-animation-fill-mode: forwards;
  225. }
  226.  
  227. body {
  228. background: #fff;
  229. }
  230. </script>
  231. </body>
  232. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement