DEMO

In the content area you can provide whatever you want to display in it โ€” using the following code from https://gist.github.com/westonwatson/3914027 that I have copied in here:

.black_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);
}
.white_content {
  display: none;
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  padding: 16px;
  border: 16px solid orange;
  background-color: white;
  z-index: 1002;
  overflow: auto;
}
<html>

<head>
  <title>LIGHTBOX EXAMPLE</title>
</head>

<body>
  <p>This is the main content. To display a lightbox click <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a>
  </p>
  <div id="light" class="white_content">This is the lightbox content. <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a>
  </div>
  <div id="fade" class="black_overlay"></div>
</body>

</html>

Answer from anon on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ howto โ€บ howto_js_popup_form.asp
How To Create a Popup Form With CSS
Google Charts Google Fonts Google Font Pairings Google Set up Analytics ยท Convert Weight Convert Temperature Convert Length Convert Speed ยท Get a Developer Job Become a Front-End Dev. Hire Developers ... Learn how to create a popup form with CSS and JavaScript.
๐ŸŒ
CodePen
codepen.io โ€บ imprakash โ€บ pen โ€บ GgNMXO
Pure css popup box
If disabled, use the "Run" button to update. If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting. Spaces ยท Tabs ยท 1 ยท 2 ยท 3 ยท 4 ยท 5 ยท 6 ยท Visit your global Editor Settings. HTML CSS JS Result ยท HTML Options ยท Format HTML ยท View Compiled HTML ยท Analyze HTML ยท Maximize HTML Editor ยท Minimize HTML Editor ยท Fold All ยท Unfold All ยท <h1>Popup/Modal Windows without JavaScript</h1> <div class="box"> <a class="button" href="#popup1">Let me Pop up</a> </div> <div id="popup1" class="overlay"> <div class="popup"> <h2>Here i am</h2> <a class="close" href="#">&times;</a> <div class="content"> Thank to pop me out of that button, but now i'm done so you can close this window.
Discussions

HTML / CSS Popup div on text click - Stack Overflow
CSS is less likely to be disabled at the browser. 2018-08-27T16:28:51.96Z+00:00 ... For the sake of completeness, what you are trying to create is a "modal window". Numerous JS solutions allow you to create them with ease, take the time to find the one which best suits your needs. I have used Tinybox 2 for small projects : http://sandbox.scriptiny.com/tinybox2/ ... The asker ask about HTML pop-up ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Pop up window with HTML CSS JS
Hi guys, can you help me out, please, on how to create a pop up window like the one that welcomes you at t the following site: https://coolors.co/ . The idea will be displaying a pic when you arrive on the site (i was thinking about using js or jquery, maybe the: .onload or maybe $( document ... More on forum.freecodecamp.org
๐ŸŒ forum.freecodecamp.org
0
0
April 19, 2021
4 Ways to Create a Modal Popup Box with Html, CSS and Vanilla JavaScript
This tutorial includes no mention of accessibility, and because it doesn't trap focus, can actually result in a bad user experience. I recommend looking over the W3 modal tutorial and incorporating some of the points about focus trapping and accessibility into this one https://www.w3.org/TR/wai-aria-practices-1.1/examples/dialog-modal/dialog.html More on reddit.com
๐ŸŒ r/learnprogramming
14
351
January 30, 2021
Simple pop-up - HTML & CSS - SitePoint Forums | Web Development & Design Community
I managed to realize a very simple pop-up, with this code: css .popup { margin: 70px auto; padding: 20px; background: #fff; border-radius: 5px; width: 40%; max-height: 80vh; position: relativโ€ฆ More on sitepoint.com
๐ŸŒ sitepoint.com
0
April 21, 2023
๐ŸŒ
W3Schools
w3schools.com โ€บ howto โ€บ howto_js_popup.asp
How To Create Popups
Google Charts Google Fonts Google Font Pairings Google Set up Analytics ยท Convert Weight Convert Temperature Convert Length Convert Speed ยท Get a Developer Job Become a Front-End Dev. Hire Developers ... Learn how to create popups with CSS and JavaScript.
๐ŸŒ
DEV Community
dev.to โ€บ pachicodes โ€บ creating-a-css-modal-window-pop-up-step-by-step-1f59
Creating a CSS modal window (pop-up) step-by-step - DEV Community
January 20, 2020 - Modal windows are kinda Pop-ups. When you click in something, it opens a window with information. For my project, I need a card with information to open when a line from a table gets a click. Later in my experiments I found out this cannot be done with CSS only, because of the line element.
Top answer
1 of 3
139

DEMO

In the content area you can provide whatever you want to display in it โ€” using the following code from https://gist.github.com/westonwatson/3914027 that I have copied in here:

.black_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);
}
.white_content {
  display: none;
  position: absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  height: 50%;
  padding: 16px;
  border: 16px solid orange;
  background-color: white;
  z-index: 1002;
  overflow: auto;
}
<html>

<head>
  <title>LIGHTBOX EXAMPLE</title>
</head>

<body>
  <p>This is the main content. To display a lightbox click <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a>
  </p>
  <div id="light" class="white_content">This is the lightbox content. <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a>
  </div>
  <div id="fade" class="black_overlay"></div>
</body>

</html>

2 of 3
15

You can simply use jQuery UI Dialog

Example:

$(function() {
  $("#dialog").dialog();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
</head>

<body>
  <div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
  </div>
</body>
</html>

๐ŸŒ
WisePops
wisepops.com โ€บ blog โ€บ html-popup
How to Create an HTML Popup [CSS, Javascript]
In this tutorial, I'll walk you through the step-by-step process of building a simple and user-friendly popup using JavaScript and CSS. Improve visitor engagement and product or service awareness. Rated 4.9 on Capterra and Shopify ... You don't need to have a website to be able to preview your work. The final version of this popup window will look like this: Define an HTML container for the popup and include elements like content, close button, and overlay (see the code below)
Find elsewhere
๐ŸŒ
freeCodeCamp
forum.freecodecamp.org โ€บ html-css
Pop up window with HTML CSS JS - HTML-CSS - The freeCodeCamp Forum
April 19, 2021 - Hi guys, can you help me out, please, on how to create a pop up window like the one that welcomes you at t the following site: https://coolors.co/ . The idea will be displaying a pic when you arrive on the site (i was thinking about using js or jquery, maybe the: .onload or maybe $( document ).ready()) with black fading background and when you click on an โ€œXโ€ top right of the pic or anywhere else but on the image, the div disappear and youโ€™ll see the body content.
๐ŸŒ
Picreel
picreel.com โ€บ home โ€บ blog โ€บ popup implementation โ€บ html popup message: quick methods with codes & steps
HTML Popup Message Guide: HTML, CSS, and JavaScript (+Hack)
October 14, 2025 - To begin with, create the structure of the HTML popup box. Here, you can include the HTML popup message, title, overlay, and close button. Now, as weโ€™ll be using CSS to further style the popup, you must link your HTML and CSS files.
๐ŸŒ
HTML Online
html-online.com โ€บ home โ€บ a very simple popup box โ€“ html, css, javascript
A Very Simple Popup Box - HTML, CSS, JavaScript
July 6, 2025 - /* Popup box BEGIN */ .hover_bkgr_fricc{ background:rgba(0,0,0,.4); cursor:pointer; display:none; height:100%; position:fixed; text-align:center; top:0; width:100%; z-index:10000; } .hover_bkgr_fricc .helper{ display:inline-block; height:100%; vertical-align:middle; } .hover_bkgr_fricc > div { background-color: #fff; box-shadow: 10px 10px 60px #555; display: inline-block; height: auto; max-width: 551px; min-height: 100px; vertical-align: middle; width: 60%; position: relative; border-radius: 8px; padding: 15px 5%; } .popupCloseButton { background-color: #fff; border: 3px solid #999; border-rad
๐ŸŒ
FreeFrontend
freefrontend.com โ€บ css-modal-windows
74 CSS Modal Windows
2 weeks ago - CSS Modal Windows collection for modern UI design. Download free HTML/CSS code for accessible dialogs and popups. View updated CodePen demos.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-make-a-pure-css-popup
How to make a pure CSS popup
August 21, 2025 - Lines 44โ€“56: We set the properties of the popup message. Lines 62โ€“69: We set the properties of the text. Lines 70โ€“73: We set the border of form. Lines 74โ€“80: We set the properties of label. Lines 81โ€“94: We set the properties of input obtained in the form. Lines 95โ€“110: We set the properties of placeholder and the login button. We now combine the HTML and CSS files to connect the popup form and its styling.
๐ŸŒ
DEV Community
dev.to โ€บ robsonmuniz16 โ€บ how-to-make-a-popup-html-css-javascript-18ml
๐Ÿ“ซHow To Make A Popup | HTML, CSS & JavaScript - DEV Community
May 13, 2023 - Learn how to create a professional-quality popup or modal window from scratch using HTML, CSS, and... Tagged with webdev, html, css, javascript.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ html โ€บ how-to-create-popup-box-using-html-and-css
How to Create Popup Box using HTML and CSS? - GeeksforGeeks
This method toggles the popup's visibility by changing its CSS display property. ... <html> <head> <style> .popup { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); justify-content: ...
Published ย  July 23, 2025
๐ŸŒ
CodingNepal
codingnepalweb.com โ€บ home โ€บ card design โ€บ create popup modal box in html css & javascript
Create Popup Modal Box in HTML CSS & JavaScript
June 23, 2022 - As you have seen in the video of this project [ Popup Modal Box]. At first, there was a button on the screen with the name โ€œOpen Modalโ€, When I clicked on that button the button disappeared and a modal box, as well as a little dark color overly behind the modal box, appeared. As you the modal box can be closed by clicking on the close button or just by clicking on the outside of the modal box. To make the UI design of this project [ Popup Modal Box], I just used HTML and CSS, and to open and close it, I used some JavaScript code.
๐ŸŒ
Medium
matemarschalko.medium.com โ€บ lets-build-a-html-and-css-only-popup-modal-5bf26ec62c7a
Lets build a HTML- and CSS-only Popup Modal | by Mate Marschalko | Medium
December 6, 2024 - Lets build a HTML- and CSS-only Popup Modal Last week I posted a detailed introduction about the basic building blocks we will need for this project: Custom Styled CSS Checkbox and Radio Buttons โ€” โ€ฆ
๐ŸŒ
SitePoint
sitepoint.com โ€บ html & css
Simple pop-up - HTML & CSS - SitePoint Forums | Web Development & Design Community
April 21, 2023 - I managed to realize a very simple pop-up, with this code: css .popup { margin: 70px auto; padding: 20px; background: #fff; border-radius: 5px; width: 40%; max-height: 80vh; position: relative; transition: all 5s ease-in-out; z-index: 20; } .popup img {max-height: 40vh;} .popup .close { position: absolute; top: 20px; right: 30px; transition: all 200ms; font-size: 30px; font-weight: bold; text-decoration: none; color: #333; } ...