Hello friends how are you , Today in this post "Display Submenu On Mouse Hover" i am going to teach you how you can Show and Hide submenu on mouse hover using very simple lines of HTML and CSS code. If you want to create a website then this post can help you to create menu , submenu and show and hide submenu effect in a very simple way. You can also customize this submenu as per your requirement, So Let's start
If you want to understand this through video then watch this video i have explained it step by step live
Now i am going to explain step by step.
Step 1:Create a Folder: Just create a folder with any name and in any drive in your system, In my case my folder name is Submenu.
Step 2:Create an HTML file: Now open notepad and type the below code or you can copy this code for your personal use
<html> <head> <title>krazyprogrammers</title> <style> body{ margin: 0; padding: 0; font-family: cursive; background-image: url('bg.jpg'); } ul{ padding: 0; list-style-type: none; background-color: #0b121b; margin-top: 0; } ul li{ display: inline-block; position: relative; line-height: 20px; text-align: left; width: 120px; } ul li ul li{ border-bottom: 1px solid white; } ul li a{ display: block; padding: 8px 25px; color: white; text-decoration: none; } ul li a:hover{ color: white; background-color: orangered; } ul li ul.name { min-width: 100%; background-color: rgba(11,18,27,0.8); color: white; display: none; position: absolute; z-index: 999; left: 0; } ul li ul li ul.topic { display: none; } ul li ul li:hover ul.topic { display: block; left: 100%; top: 0%; position: absolute; } ul li:hover ul.name { display: block; } ul li ul.name li{ display: block; } </style> </head> <body> <ul> <li><a href="#">Home</a></li> <li><a href="#">Programming</a> <ul class="name"> <li><a href="#">C</a> <ul class="topic"> <li><a href="#">Tutorial</a></li> <li><a href="#">Program</a></li> <li><a href="#">Interview Q/A</a></li> </ul> </li> <li><a href="#">C++</a> <ul class="topic"> <li><a href="#">Tutorial</a></li> <li><a href="#">Program</a></li> <li><a href="#">Interview Q/A</a></li> </ul> </li> <li><a href="#">Java</a> <ul class="topic"> <li><a href="#">Tutorial</a></li> <li><a href="#">Program</a></li> <li><a href="#">Interview Q/A</a></li> </ul> </li> <li><a href="#">Python</a> <ul class="topic"> <li><a href="#">Tutorial</a></li> <li><a href="#">Program</a></li> <li><a href="#">Interview Q/A</a></li> </ul> </li> </ul> </li> <li><a href="#">Projects</a></li> <li><a href="#">Registration</a></li> <li><a href="#">Login</a></li> <li><a href="#">About</a></li> </ul> </body> </html>
0 Comments