In the last 3 articles, we learned about various ways to implement navigation bar using CSS and now you can easily implement them in web pages. Moving forward, we are going to learn about dropdowns in CSS. Dropdowns are used when you have to give more information about a particular element but do want to show only if the user is interested.
Create Basic Dropdown
Important points to note:
- Create div containing text to hover inside which another div containing text to be shown after hovering
- Initially hide the content of second div using display property
- Use :hover pseudo-class on the first div to change display property of the second div
Now create dropdown yourself without seeing the code...
Create Dropdown Menu
The example is very similar to the previous one except we will add a list of links inside hover content.
Create Dropdowns Inside Navbar
You can easily create dropdowns inside navbars by placing above created element as one of the list element in the navbar items list.
Use dropdowns on Images
Although not used frequently, we can use the dropdown to show the full image when the user hovers over the small image. You just have to replace text in above examples by images and set the height and width property of images accordingly.
That's all for today. In the next article, we are going to learn about tooltips in CSS which are used to show help test in web pages when you hover over them which uses the same concept as we used today.
Comments
Post a Comment