CSS text hover dropdown appears when you put your mouse cursor over the text and a dropdown item will be shown. See a source code to achieve this function using CSS code.
CSS dropdown menu is used when you want to show sub-categories on the mouse over the main categories. You can show dropdown items over the simple text, navigation bar, and images.
From the above source code, replace top:0; by bottom:0; which will put your horizontal navigation bar at the bottom of your page and over your content.
See the below Source Code and output :
<!DOCTYPE html>
<html>
<style>
body {
margin:5px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: grey;
position: fixed;
bottom: 0;
width: 100%;
}
li {
float:left;
list-style-type: none;
border-right: 3px solid grey;
}
li:last-child {
border-right: none;
}
a {
display: block;
padding: 8px;
background-color: #dddddd;
text-decoration:none;
}
</style>
<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about_us">About Us</a></li>
<li><a href="#blog">Blog</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<br>
<div class="body">
<h3> Fixed Bottom Navigation Bar</h3>
<p>
Ullamcorper molestie volutpat egestas placerat leo orci. Elementum mattis porttitor <strong>ultricies</strong> ac hendrerit pretium. Adipiscing facilisis erat dictum aliquam interdum sagittis fermentum ultricies phasellus metus urna dictumst purus risus. Sed imperdiet nec facilisi curae; vivamus posuere vestibulum gravida orci natoque consequat adipiscing sagittis auctor eu Neque inceptos nostra nibh faucibus potenti dictum placerat nulla congue faucibus, pede. Nam litora torquent vestibulum consectetuer ipsum taciti interdum hac convallis, dictum bibendum. Dapibus. Imperdiet est etiam Iaculis habitant <strong>volutpat</strong> ligula et. Malesuada rhoncus lacus iaculis massa, leo hendrerit dapibus imperdiet eget non magna molestie blandit <strong>varius</strong> conubia sodales tempus. Hendrerit urna habitasse dis.</p>
<p>
Ullamcorper molestie volutpat egestas placerat leo orci. Elementum mattis porttitor <strong>ultricies</strong> ac hendrerit pretium. Adipiscing facilisis erat dictum aliquam interdum sagittis fermentum ultricies phasellus metus urna dictumst purus risus. Sed imperdiet nec facilisi curae; vivamus posuere vestibulum gravida orci natoque consequat adipiscing sagittis auctor eu Neque inceptos nostra nibh faucibus potenti dictum placerat nulla congue faucibus, pede. Nam litora torquent vestibulum consectetuer ipsum taciti interdum hac convallis, dictum bibendum. Dapibus. Imperdiet est etiam Iaculis habitant <strong>volutpat</strong> ligula et. Malesuada rhoncus lacus iaculis massa, leo hendrerit dapibus imperdiet eget non magna molestie blandit <strong>varius</strong> conubia sodales tempus. Hendrerit urna habitasse dis.</p>
</div>
</body>
</html>
CSS Horizontal Navigation bar displays the menu horizontally. To build a horizontal menu, you need to specify the <li> elements into display inline.
Horizontal Navigation Bar
See an below image of horizontal navigation bar.
By default <li> elements are display in a list, you need to use list-style-type property to hide the bullets and apply display:inline property to <li> elements.
You can make horizontal list items by applying float property in <li> elements. See an example below of using float property to create horizontal menu bar.
In the above source code, the fourth element “contact” is selected by using nth-child(n) property and apply float: right property value to keep at the end of the right side.
Horizontal Navigation Bar With Border Right Dividers
To separate each navigation bar, you need to apply border-right in your <li> elements and remove the border at your last <li> child.
See the below source code and output to understand more in details.
Horizontal Navigation Bar With Border Left Dividers
You can also use border-left to separate the navigation bar menu, but make sure you only apply the border-left property to all <li> elements except the first child of <li> element.
CSS Vertical Navigation bar displays all your menu items vertically. See a below example of a vertical Navigation Bar. To create a vertical navigation bar, you need to style <a> element inside <li>.
Vertical Navigation Bar
Source Code:
<!DOCTYPE html>
<html>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 300px;
background-color: lightgrey;
}
li a {
display: block;
color: black;
padding: 8px 16px;
text-decoration: underline;
}
/* Change the link color on hover */
li a:hover {
background-color: black;
color: white;
}
</style>
<body>
<h3> Vertical Naviation Bar</h3>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about_us">About Us</a></li>
<li><a href="#blog">Blog</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</body>
</html>
CSS Opacity is also known as CSS transparency. It specifies the transparency of an element. You can apply transparency wherever you needed like at the image, hover the image, text in a transparent box, and so on.
Syntax:
opacity: 0.4;
Image Opacity:
The default opacity value is 1. The opacity value starts from 0.0 to 1. The lower value is the most transparent element.
When you use the opacity property to add transparency in the background container, all of its child elements inherit the same transparent. As a result, if you have text inside the container will have the same parent opacity and it will make it a bit hard to read the text.
See an example below of using transparent in parent container and its child text elements also have same transparent.
In the above example, both parent and child elements use the same opacity value. If you want the child element not to use its parent element opacity then the best way to use transparent is by using the RGBA value in your parent background element.