第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

css中fixed如何定位在屏幕的正中間,并在周圍生成一個半透明的黑色遮罩??

css中fixed如何定位在屏幕的正中間,并在周圍生成一個半透明的黑色遮罩??

紫衣仙女 2019-03-05 07:23:58
    <div id ="contract_template_select">        <div id="template_title">選擇模板</div>    </div>
查看完整描述

2 回答

?
狐的傳說

TA貢獻1804條經(jīng)驗 獲得超3個贊

<div class="mask">

  <div class="dialog"></div>

</div>


.mask {

   position: fixed;

   width: 100%;

   height: 100%;

   background: rgba(0, 0, 0, .3)

}

.dialog {

   // 寬高必須要聲明,對于寬高不固定這個方法不適用

   width: 200px;

   height: 200px;

   border-radius: 5px;

   position: absolute;

   left: 0;

   right: 0;

   top: 0;

   bottom: 0;

   margin: auto;

}


查看完整回答
反對 回復 2019-03-05
?
森欄

TA貢獻1810條經(jīng)驗 獲得超5個贊

如果已知盒子div的width 和 height, 可以試試


div{

    position:fixed;

    left:50%;

    margin-left:- div的width的一半;

    top:50%;

    margin-top: - div的height的一半;

}

至于題主要的半透明黑色遮罩 可以使用::after


div::after{

    content: " ";

    width: 100%;

    height: 100%;

    position: fixed;

    background: rgba(0,0,0,.3);

    top: 0;

    left: 0;

    z-index: 0;

}

居中的方法還有挺多的 可以參考 《CSS制作水平垂直居中對齊》


查看完整回答
反對 回復 2019-03-05
  • 2 回答
  • 0 關(guān)注
  • 2917 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號