2-1 通过阴影

<style>.overlay {/* 用于遮挡背景 */position: fixed;top: 0;right: 0;bottom: 0;left: 0;background: rgba(0, 0, 0, .8);}.lightbox {/* 需要吸引用户注意的元素 */position: absolute;z-index: 1;/* [其余样式] */width: 200px;height: 100px;background-color: white;top:50%;left:50%;transform: translate(-50%,-50%);}</style>
