CSS Dropdowns

it is used to allows the user choose a list options.


<!DOCTYPE html>
    .dropbtn {
      background-color: red;
      color: white;
      padding: 9px;
      font-size: 16px;
      border: none;
      cursor: pointer;
    .dropdown {
      position: relative;
      display: inline-block;
    .dropdown-content {
      display: none;
      position: absolute;
      background-color: pink;
      min-width: 160px;
      box-shadow: 0px 9px 16px 0px rgba(0,0,0,2.2);
      z-index: 1;
    .dropdown-content a {
      color: black;
      padding: 12px 16px;
      text-decoration: none;
      display: block;
    .dropdown-content a:hover {background-color: gray}
    .dropdown:hover .dropdown-content {
      display: block;
    .dropdown:hover .dropbtn {
      background-color: red;
    <h2>Dropdown Menu</h2>
    <p>Move the mouse over the button to open the dropdown menu.</p>
    <div class="dropdown">
      <button class="dropbtn">Dropdown</button>
      <div class="dropdown-content">
      <a href="#">Link 1</a>
      <a href="#">Link 2</a>
      <a href="#">Link 3</a>

Click on the "Run This Code" button to see how it works.


Welcome CSS Syntax CSS Selectors CSS ADD css CSS Borders CSS Backgrounds CSS Colors CSS Padding CSS Margin CSS Fonts CSS Text CSS Outline CSS Box-Model CSS Height&Width CSS Icons CSS Links CSS Lists CSS Display CSS Tables CSS Position CSS Overflow CSS Align CSS Float CSS Inline-block CSS Opacity CSS Image-Gallery CSS Navigation Bar CSS Dropdowns CSS Cursors CSS Forms CSS Pseudo-classes CSS Pseudo-elements


CSS Gradients CSS shadows CSS 2D Transforms CSS 3D Transforms CSS Animations CSS Media Queries CSS Flexbox CSS important CSS Units