Concepts 🚀 Project 🧮 Labs
🧮 Labs / CSS / Alert boxes — success, error, warning, info

Alert boxes — success, error, warning, info

4 colored boxes for user feedback. Each has an icon, a title, and a message.

style.css v3.1
style.css — the CSS rules
index.html — the HTML structure (what the CSS targets)
Live preview updates as you type
🧠 How it works

Every alert has the same STRUCTURE (icon + title + msg) but different COLORS. The base .alert class handles layout (flex, gap, padding, border-left). The .alert-success/error/warning/info classes only set colors. border-left: 4px solid — a colored bar on the left. The actual color is set per-type. Background uses hex + '15' suffix = 8% opacity (hex alpha: 15 = 0x15 = 21/255 ≈ 8%). Text color is a DARKER shade of the same hue — keeps it readable on the light background. display: flex + align-items: flex-start — icon sits at the top-left, content fills the rest.

✏️ Try these changes
  • Change border-left: 4px to 8px
    → thicker colored bar on the left
  • Change .alert-success background to #3fb95030
    → darker green background (more opaque)
  • Add a 5th type: .alert-neutral { background: #88888815; border-left-color: #888; color: #333; }
    → grey neutral alert
  • Change border-radius: 8px to 0
    → sharp corners — more 'system message' look