div+css=>遮罩+彈出框(固定在頁面中間)

效果圖

這裏寫圖片描述

css代碼

<style type="text/css" >
body{
     font-family: "Microsoft YaHei" ! important;
}
/*灰色遮罩層*/
.fade{
    width:100%;
    height:100%;
    background:rgba(0, 0, 0, 0.5);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 99;
}
/*彈出層*/ 
.succ-pop{
    width: 400px;
    height: 300px;
    background: #fff;
    position: fixed;
    left: 50%;
    top: 50%;
    margin-left: -200px;
    margin-top: -150px;
    z-index: 999;
    border-radius: 5px;
}   
.succ-pop h3.title{
    text-align: center;
    font-size: 22px;
    color: #ce002c;
}
</style>

html代碼

<div class="fade"></div>
<div class="succ-pop">
    <h3 class="title">
        中間填寫內容
    </h3>
</div>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章