In this example , I have created a box div having button which when clicked, a popup window will appear. Next I have created a popup div with a close class inside an anchor tag containing content in it.
Below is the HTML code of the example :-
<meta content="width=device-width, initial-scale=1" name="viewport">
<link rel="stylesheet" type="text/css" href="css/style.css">
<a class="button" href="#popup1">Let me Pop up</a>
<div id="popup1" class="overlay">
<h2>Here i am</h2>
<a class="close" href="#"></a>
Thanks for pop me out of that button, but now i'm done so you can close this window.
In the CSS , In the box div I have set the width and inside the box adjusted the background , border-radius and provided a border to it.
To the button class, I have applied the border-radius, set the border and have set the transition property and whenever we hover on the button the background changes into orange colour.
To the overlay class , I have set its position absolute and has used visibility:hidden which helps to hide the content i.e the popup window text. In this I have also used target selector to the overlay class which is used to style the current active target element.
Next for the popup , i have created a popup class and have set various properties for its display by setting the transition to all 5s ease-in-out.
Inside the popup class div, in the anchor tag I have created a close class for closing the popup window when not needed and set its position absolute with the transition property for 200ms.
I have changed the close icon colour to orange whenever we hover over it.
Below is the CSS Code of the example :-