FREE Web Template Download
HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULARJS TUTORIALS REFERENCES EXAMPLES Blog
 

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

<div class="subhodaya-dropdown-hover">
  <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>

Try it Yourself »

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

<div class="subhodaya-dropdown-hover">
  <p>Hover Me!
    <span class="subhodaya-dropdown-content subhodaya-green">
      Hello World!
    </span>
  </p>
</div>

Try it Yourself »


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

<ul class="subhodaya-navbar subhodaya-card-2 subhodaya-light-grey">
  <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>
Try It Yourself »

Clickable Dropdown

The TheBestTutorials-dropdown-click class is similar to TheBestTutorials-dropdown-hover, except that the dropdown is opened by JavaScript.

Example

<div class="subhodaya-dropdown-click">
  <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>

Try it Yourself »


Image Dropdowns

Move the mouse over the image:

Monterosso

Norway

Example

<div class="subhodaya-dropdown-hover">
  <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>

Try it Yourself »


Card Dropdowns

Move the mouse over one of the cities below:

London
London

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
London

Tokyo is the capital city of Japan.

13 million inhabitants.

Example

<div class="subhodaya-dropdown-hover">London
  <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>

Try it Yourself »


Animated Dropdown

Use any of the TheBestTutorials-animate-classes to fade, zoom or slide in the dropdown content:

Example

<div class="subhodaya-dropdown-click">
  <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>

Try it Yourself »


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

<div class="subhodaya-dropdown-hover subhodaya-right">
  <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>

Try it Yourself »