css popup window grey background

Tags | CSS modal popup box, popup box using CSS, HTML CSS popup window example, CSS lightbox popup, CSS popup box responsive

Html CSS Popup Window Example

A CSS lightbox popup is an effect that fades the page in the background to show you new content in the foreground. Learn how to create popups with CSS and JavaScript.

CSS Popup Window onClick

There are a lot of light-box codes available over the internet with animations. Most of them required heavy use of javascript and some may require an additional framework or a third-party tool. Find the below source code :

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Demo.aspx.cs" Inherits="Demo" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>CSS PopUp Window Disable Background</title>
    <style type="text/css">
        .dark_overlay {
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            z-index: 1001;
            -moz-opacity: 0.8;
            opacity: .80;
            filter: alpha(opacity=80);

        .bright_content {
            display: none;
            position: absolute;
            top: 25%;
            left: 25%;
            width: 50%;
            height: 50%;
            padding: 16px;
            border: 5px solid #C5D1E2;
            background-color: white;
            z-index: 1002;
            overflow: auto;
    <form id="form1" runat="server">
        <h2>Display html/css popup window onClick and disable background</h2>
            <b>Browser compatibility</b> | Latest versions of Chrome, IE, Firefox, Opera, Edge
        <br />
        <br />
            Click here to display lightbox click <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a>

        <div id="light" class="bright_content">
            <asp:Label ID="lbltext" runat="server" Text="Hey there!"></asp:Label>
            <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a>

                <b>CSS Popup Box Responsive</b><br />
                It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. 
                The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. 
                Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy.
                Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
        <div id="fade" class="dark_overlay">

Download Source Code

Did you find this post useful? I hope you liked this article. Please share with me your valuable suggestions and feedback.


Please enter your comment!
Please enter your name here