w1coding.comAll tutorials

W3.CSS Dropdown

W3.CSS lessons
  1. Environment Setup
  2. Introduction
  3. Container
  4. Colors
  5. Buttons
  6. Buttons1
  7. Grids
  8. Images
  9. Cards
  10. Tables
  11. Forms
  12. Navigation
  13. Sliders
  14. Modals
  15. Dropdown
  16. Cards
  17. Alerts
  18. Accordions
  19. Ardions
  20. Tooltips
  21. Pagination
  22. Navigation
  23. Slideshow
  24. Tabs
  25. Model
  26. Animations
  27. Responsive

W3.CSS Dropdowns

Dropdowns in W3.CSS are created using the w3-dropdown and w3-dropdown-content classes.

Basic Dropdown Example

<div class="w3-dropdown-hover">
  <button class="w3-button w3-blue">Dropdown</button>
  <div class="w3-dropdown-content w3-bar-block w3-card">
    <a href="#" class="w3-bar-item w3-button">Option 1</a>
    <a href="#" class="w3-bar-item w3-button">Option 2</a>
    <a href="#" class="w3-bar-item w3-button">Option 3</a>
  </div>
</div>
    

Positioned Dropdown

Add w3-right or w3-left to control the dropdown position:

<div class="w3-dropdown-hover w3-right">
  <button class="w3-button w3-green">Dropdown</button>
  <div class="w3-dropdown-content w3-bar-block w3-card">
    <a href="#" class="w3-bar-item w3-button">Option A</a>
    <a href="#" class="w3-bar-item w3-button">Option B</a>
  </div>
</div>