P
P
Programmer2021-06-19 19:27:02
css
Programmer, 2021-06-19 19:27:02

How to make a smooth dropdown?

How to make a smooth dropdown?
The code:

<header class="header">
        <nav class="menu">
            <ul>
                <li class="dropdown">
                    <a href="javascript:void(0)" class="dropbtn">Products</a>
                    <div class="dropdown-content">
                      <a href="#">Link 1</a>
                      <a href="#">Link 2</a>
                      <a href="#">Link 3</a>
                    </div>
                  </li>
                  <li class="dropdown">
                    <a href="javascript:void(0)" class="dropbtn">Rooms</a>
                    <div class="dropdown-content">
                      <a href="#">Link 1</a>
                      <a href="#">Link 2</a>
                      <a href="#">Link 3</a>
                    </div>
                  </li>
                <li><a href="#">Inspirations</a></li>
            </ul>
        </nav>
    </header>

li.dropdown {
    display: inline-block;
  }
  
  .dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
  }
  
  .dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    transition: background-color .2s linear;
}
  
  .dropdown-content a:hover {background-color: #f1f1f1;}
  
  .dropdown:hover .dropdown-content {
    display: block;
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan765, 2021-06-19
@Ivan765

I advise you to use animate.css

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question