Menu
Coddy logo textTech

Notification Banners

Part of the Practical Frontend section of Coddy's HTML journey — lesson 24 of 35.

Notification banners alert users about important information like success messages, warnings, or errors. They typically appear at the top or bottom of a page. You’ve probably seen them used for things like:

  • Success messages – e.g., “Your profile was updated successfully.”
  • Error messages – e.g., “Something went wrong, please try again.”
  • Info alerts – e.g., “We’ve updated our privacy policy.”

Let's create a simple notification banner. Start with a basic container:

<div class="notification">
  This is a notification message!
</div>

Add some styling to make it stand out:

.notification {
  background-color: #4CAF50;
  color: white;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 4px;
}

This creates a green notification banner with white text.

challenge icon

Challenge

Easy

You are given the HTML for a notification banner. Your task is to style it so it looks like a real success message.

Your task:

  1. Place the icon and text next to each other by using <strong>display: flex</strong> and <strong>align-items: center</strong>.
  2. Add padding inside the banner to make it more readable.
  3. Give the banner a green background (#4CAF50) and make the text white, since it’s a success notification.
  4. Round the corners.
  5. Add a box shadow so the banner has some depth.
  6. Add spacing between the icon and the text using <strong>margin-right</strong>.
  7. Make the icon slightly bigger with <strong>font-size: 18px</strong>.

Goal: Your banner should look like a clean success message with a checkmark icon on the left and text on the right.

Try it yourself

<!DOCTYPE html>
<html>
<head>
  <title>Notification Banners</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      padding: 20px;
    }
    
    .notification {
    
    }
    
    .notification_icon {
        
    }
  </style>
</head>
<body>
  <div class="notification notification--success">
    <span class="notification_icon">✓</span>
    <div class="notification_message">Your changes have been saved successfully!</div>
  </div>
</body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Practical Frontend