Open In App

Primer CSS Alerts Flash Banner

Last Updated : 19 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, and BEM architecture. It is highly reusable and flexible. It is created with GitHub’s design system.

In this article, we will learn about Primer CSS Alerts Flash Banner. Primer CSS Alerts Flash Banner is used to flash a message that is fixed positioned at the top of the page.

Syntax:

<div class="flash flash-banner">
    <!--Flash banner message.-->
</div>

Example 1: In this example, we will simply place a flash banner. You will notice that the flash banner is placed at the top using the flash and flash-banner classes.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <link href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css"
          rel="stylesheet" />
</head>
  
<body>
    <div class="flash flash-banner">
        Flash banner message.
    </div>
    <div style="margin-top:5%">        
        <h1 style="color:green">
              GeeksforGeeks
          </h1>
        <h3> Alert Flash Banner</h3>
    </div>
</body>
    
</html>


Output:

 

Example 2: In this example, we will apply a button to get a flash banner. 

HTML




<!DOCTYPE html>
<html>
  
<head>
    <link href=
"https://unpkg.com/@primer/css@^16.0.0/dist/primer.css"
        rel="stylesheet" />
      
    <style>
        body {
            margin-left: 10px;
            margin-right: 10px;
        }
    </style>
</head>
  
<body>
    <div class="flash flash-banner"
        style="display:none;" id="GFG">
        Flash banner message.
    </div>
  
    <div style="margin-top:5%;">
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
          
        <h3> Alert Flash Banner</h3>
          
        <button onclick="getAlert()">
            Click me
        </button>
        </br></br>
    </div>
  
    <script>
        function getAlert() {
            document.getElementById("GFG")
                .style.display = 'block';
        }
    </script>
</body>
  
</html>


Output:

 

Reference: https://primer.style/css/components/alerts#flash-banner



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads