18 CSS Close Buttons

Modal Corner

A larger absolute-positioned corner X — the kind you put on lightboxes and image galleries. Hover leaves a soft purple trail behind the cursor.

Pure CSS MIT licensed

Modal Corner the 16th of 18 designs in the 18 CSS Close Buttons collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.

Live preview

Open in playground

The code

<button class="ccb-corner" aria-label="Close modal"><span></span><span></span></button>
.ccb-corner {
  width: 48px; height: 48px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  position: relative; cursor: pointer; overflow: hidden;
  transition: background 0.25s, border-color 0.25s;
}
.ccb-corner::before {
  content: ''; position: absolute; inset: -50%;
  background: radial-gradient(circle at center, rgba(124,108,255,0.4) 0%, transparent 60%);
  opacity: 0; transition: opacity 0.3s;
}
.ccb-corner:hover { background: rgba(255,255,255,0.1); border-color: rgba(124,108,255,0.4); }
.ccb-corner:hover::before { opacity: 1; }
.ccb-corner span {
  position: absolute; top: 50%; left: 50%;
  width: 18px; height: 2px;
  background: #f0eeff; border-radius: 2px;
  z-index: 1;
  transition: background 0.25s, transform 0.3s;
}
.ccb-corner span:nth-child(1) { transform: translate(-50%,-50%) rotate(45deg); }
.ccb-corner span:nth-child(2) { transform: translate(-50%,-50%) rotate(-45deg); }
.ccb-corner:hover span { background: #fff; }
.ccb-corner:hover span:nth-child(1) { transform: translate(-50%,-50%) rotate(135deg); }
.ccb-corner:hover span:nth-child(2) { transform: translate(-50%,-50%) rotate(-135deg); }

Search CodeFronts

Loading…