<div class="container">
  <div class="card">
    <h2>CSS Glass Background</h2>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
  </div>
</div>
* {
  font-family: "Proza Libre", sans-serif;
  margin: 0;
  padding: 0;
}
body {
  background: url(https://images.unsplash.com/photo-1453032037654-1f17dd472a6c)
    no-repeat;
  background-attachment: fixed; /* 讓背景固定,即便元素的內容滾動,背景也不會隨著元素移動 */
  background-size: cover;
  background-position: center center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  backdrop-filter: blur(6px); /* 背景濾鏡設定為 blur */
  margin: 0 auto;
}
.container {
  max-width: 40%;
  box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.4);
  border-radius: 20px;
  position: relative;
  background: inherit; /* 容器的背景繼承父元素,但不設製 blur 效果 */
  overflow: hidden;
}
.card {
  color: #ffffff;
  padding: 30px;
  background-color: rgba(0, 0, 0, 0.65); /* 卡片設定透明度65%背景 */
}
h2 {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 16px;
}
p {
  font-size: 16px;
  line-height: 1.5;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.