Sunday, 6 August 2017

Flip Navigation using HTML and CSS

Flip Navigation using HTML and CSS

Hello friends, In this tutorial we are going to create a Flip Navigation  using HTML and CSS. This is a pure HTML and CSS tutorial. So instead searching a plugin lets write together.

Step 1 :


First we create our HTML markup
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Flip Navigation using CSS</title>
  5. </head>
  6. <body>
  7. <div class="container">
  8. <ul>
  9. <li><a href="#"><span data-back="Home">Home</span></a></li>
  10. <li><a href="#"><span data-back="About">About</span></a></li>
  11. <li><a href="#"><span data-back="Services">Services</span></a></li>
  12. <li><a href="#"><span data-back="Contact">Contact</span></a></li>
  13. </ul>
  14. </div>
  15. </body>
  16. </html>

Step 2 :

After creating HTML markup lets style it with css :
  1. *{
  2. margin: 0;
  3. padding:0;
  4. font-family: arial;
  5. color: #888;
  6. }
  7. .container{
  8. width: 100vw;
  9. height: 150px;
  10. background: skyblue;
  11. display: flex;
  12. justify-content: center;
  13. align-items: center;
  14. }
  15. .container ul{
  16. list-style-type: none;
  17. position: absolute;
  18. margin: 0px;
  19. padding: 0px;
  20. }
  21. .container ul li{
  22. float: left;
  23. background: #fff;
  24. margin: 2px;
  25. }
  26. .container ul li a{
  27. text-decoration: none;
  28. position: relative;
  29. color: #00f;
  30. display: block;
  31. width: 140px;
  32. height: 50px;
  33. line-height: 50px;
  34. text-align: center;
  35. border-top: 4px solid #00f;
  36. }
  37. .container ul li a span{
  38. width: 100%;
  39. height: 100%;
  40. background: #fff;
  41. display: block;
  42. color: #000;
  43. transform-style: preserve-3d;
  44. perspective: 1000;
  45. }
  46. .container ul li a span:before {
  47. content: attr(data-back);
  48. position: absolute;
  49. left: 0;
  50. top: 0;
  51. display: block;
  52. background: #236468;
  53. color: #fff;
  54. transform-origin: top;
  55. transform: rotateX(270deg);
  56. height: 100%;
  57. width: 100%;
  58. transition: .8s;
  59. }
  60. .container ul li a:hover span:before {
  61. transform: rotateX(0deg);
  62. }
  63. .container ul li a span:after {
  64. content: attr(data-back);
  65. position: absolute;
  66. left: 0;
  67. top: 0;
  68. display: block;
  69. background: orange;
  70. color: blue;
  71. transform-origin: top;
  72. transform: rotateX(270deg);
  73. height: 100%;
  74. width: 100%;
  75. transition: .8s;
  76. }
  77. .container ul li a:hover span:after {
  78. transition-delay: 0.3s;
  79. transform: rotateX(0deg);
  80. }
I have try to make things simple. I hope it will help you in your project.

Author : Naresh Pal
Website : http://nareshonline.com/flip-navigation-using-html-and-css/

No comments:

Post a Comment

Upload file using PHP

Upload file using PHP This is a simple tutorial to learn how to upload file using PHP with the help of HTML form. PHP makes it very...