html
<div id="pop_out"> <div id="pop"> <h2>绑定会员卡</h2> <div class="pop_input"> <label>会员卡号</label> <input type="number" placeholder="请输入会员卡号"> </div> <button class="sure_btn">确定</button> </div> </div>
css
#pop_out{ width: 100%; background-color: rgba(0,0,0,.6); position: absolute; top: 0; left: 0; bottom: 0; z-index: 2; } #pop{ width: 8.8rem; height: 8.6rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; background: linear-gradient(to bottom, #AB2622, #890301); position: fixed; top:50%; left: 50%; transform:translate(-50%,-50%); z-index: 2; }