w1coding.comAll tutorials

W3.CSS Alerts

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 Alerts

Use the w3-panel and w3-border classes to create styled alerts.

Basic Alerts

<div class="w3-panel w3-red w3-border">
  <p>Error: Something went wrong!</p>
</div>

<div class="w3-panel w3-green w3-border">
  <p>Success: Your action was successful!</p>
</div>
    

Closable Alerts

Use JavaScript to make the alerts closable:

<div class="w3-panel w3-yellow w3-border" id="alert">
  <span onclick="document.getElementById('alert').style.display='none'"
        class="w3-button w3-display-topright">&times;</span>
  <p>Warning: Please check your input.</p>
</div>