Skip to main content

Alert Strip Design | Rustcode


"Alert Strip" is almost used in every website which shows the alert or message to the users. This extra element addition improves the website interaction and makes a reliable user experience. Another animation is also used to create this effect that is "Snackbar". Snackbar is a modern concept to create a notification bar you can check out this effect on this website.

To create "Alert Strip" html, css and javascript are used. css is used to beautify design and javascript is used to close the alert.

You can read our interesting articles on web development. The link is given below.


<!DOCTYPE html>
  <title>Alert Strip Design | Rustcode</title>	
  <link rel="stylesheet" href="style.css">


    main content.


02. HTML

  <div class="content">
    <h2>Alert Message</h2>
    <p>Click on the "x" symbol to close the alert message.</p>
    <p>We use different colored strips to show different messages.</p>
  <div class="strip success">
    <span class="closebtn" onclick="closeAlert(this)">&times;</span>
    <strong>Success!</strong> Indicates a successful or positive action.
  <script src="script.js"></script>

03. css

  padding: 0px;
  margin: 0px;
  font-family: arial ,helvetica, sans-serif;
  color: white;
  background: #2d3142;
  width: 60%;
  margin: auto;
  text-align: center;
  width: 60%;
  margin: auto;
  padding: 24px;
  background-color: black;
  color: white;
  border-radius: 4px;
  letter-spacing: 1px;
  opacity: 1;
  transition: opacity .8s;
  color: white;
  float: right;
  font-weight: bold;
  font-size: 24px;
  cursor: pointer;

04. JavaScript

function closeAlert(self){
  var i = self.parentElement; = "0";
  setTimeout(function(){ = "none";

05. Youtube Video

Here I am attaching a YouTube video from my channel so that you can understand this article better and you can create a better web user interface. I have a lot of videos on my YouTube channel which is related to the user interface and web development. You can also, learn about web development from there.


After reading this article and watching a YouTube video, if you want to download source code, you can download from here and change this according to your need.