Simple Modal

Post Reply
admin
Site Admin
Posts: 31
Joined: Mon Sep 16, 2024 5:00 pm
Contact:

Simple Modal

Post: # 273Post admin »

Simple Modal with HTML and CSS

CSS

Code: Select all

.exit-intent {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  text-align: center;
  background-color: rgba(255, 255, 255, .8);
  z-index: 7;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto
}

.exit-intent {
  position: fixed;
  max-width: 500px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  visibility: hidden;
  opacity: 0;
  z-index: 1;
}

.exit-intent:target {
  visibility: visible;
  opacity: 1;
}

.exit-intent-close {
  position: absolute;
  max-width: 500px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
}

.exit-intent .close {
  position: absolute;
  right: 5px;
  top: 5px;
  padding: 5px;
  color: #000;
  font-size: 2em;
  line-height: 0.6em;
  font-weight: bold;
}

.exit-intent .close:hover {
  color: #999;
}

.close-exit-intent {
  background: rgba(0, 0, 0, 0.7);
  cursor: default;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  visibility: hidden;
}

.exit-intent:target+.close-exit-intent {
  opacity: 1;
  visibility: visible;
}

HTML

Code: Select all

<a href="#exit-intent">Link</a>
<div id="exit-intent" class="exit-intent">
  <a href="#" class="close">&times;</a>
  <h2>Window</h2>
</div>
<a href="#" class="close-exit-intent"></a>

[MODAL-CSS] Click Me
×

Window

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest