TheBestTutorials.css Dropdowns
Dropdown Hover
The TheBestTutorials-dropdown-hover class defines an hoverable dropdown element.
The TheBestTutorials-dropdown-content class defines the dropdown part to be displayed.
Example
<button class="subhodaya-btn subhodaya-red">Hover Me!</button>
<div class="subhodaya-dropdown-content subhodaya-border">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
Both the hoverable element part and the dropdown element can be any HTML element.
In the previous example the hoverable part was a <button>, and the dropdown part a <div>.
In the next example the hoverable part is a <p> element, and the dropdown part is a <span>:
Example
<p>Hover Me!
<span class="subhodaya-dropdown-content subhodaya-green">
Hello World!
</span>
</p>
</div>
Menu Dropdown
The TheBestTutorials-dropdown-hover class is perfect for dropdown navigation menus.
You will learn more about navigation bars in a later chapter.
Example
<li><a href="#">Home</a></li>
<li><a href="#">Link 1</a></li>
<li class="subhodaya-dropdown-hover">
<a href="#">Dropdown <i class="fa fa-caret-down"></i></a>
<div class="subhodaya-dropdown-content subhodaya-white subhodaya-card-4">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</li>
</ul>
Clickable Dropdown
The TheBestTutorials-dropdown-click class is similar to TheBestTutorials-dropdown-hover, except that the dropdown is opened by JavaScript.
Example
<button onclick="myFunction()" class="subhodaya-btn">Click Me</button>
<div id="Demo" class="subhodaya-dropdown-content subhodaya-card">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
<script>
function myFunction() {
var x = document.getElementById("Demo");
if (x.className.indexOf("subhodaya-show") == -1)
x.className += " subhodaya-show";
else
x.className = x.className.replace(" subhodaya-show", "");
}
}
</script>
Image Dropdowns
Move the mouse over the image:
Example
<img src="img_fjords.jpg" alt="Norway" style="width:20%">
<div class="subhodaya-dropdown-content" style="width:300px">
<img src="img_fjords.jpg" alt="Norway" style="width:100%">
</div>
</div>
Card Dropdowns
Move the mouse over one of the cities below:
London is the capital city of England.
It is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants.
Tokyo is the capital city of Japan.
13 million inhabitants.
Example
<div class="subhodaya-dropdown-content subhodaya-card-4" style="width:250px">
<img src="img_london.jpg" alt="London" style="width:100%">
<div class="subhodaya-container">
<p>London is the capital city of England.</p>
<p>It is the most populous city in the UK.</p>
</div>
</div>
</div>
Animated Dropdown
Use any of the TheBestTutorials-animate-classes to fade, zoom or slide in the dropdown content:
Example
<button onclick="myFunction()" class="subhodaya-btn">Click Me</button>
<div id="Demo" class="subhodaya-dropdown-content subhodaya-animate-zoom">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
Right-aligned Dropdown
Use TheBestTutorials-right to float the dropdown to the right and use CSS to position the dropdown content (right:0 will make the dropdown menu go from right to left instead of left to right):
Example
<button class="subhodaya-btn subhodaya-blue">Dropdown</button>
<div class="subhodaya-dropdown-content subhodaya-border" style="right:0">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>