方法一:
//遮罩層//內(nèi)容區(qū)
.bg{ width:100%; height:100%; left:0; top:0; position:fixed; background:rgba(0,0,0,0.3); } .point{ position:absolute; left:50%; top:50%; } .pop{ width:500px; height:500px; position:absolute; left:-250px; top:-250px; border:2px solid red; }
方法二:margin負(fù)邊距法
.bg{ width:100%; height:100%; left:0; top:0; position:fixed; background:rgba(0,0,0,0.3); } .pop{ width:500px; height:500px; position:absolute; left:50%; top:50%; left:-250px; top:-250px; border:2px solid red; }
方法三:transform屬性
.bg{ width:100%; height:100%; left:0; top:0; position:fixed; background:rgba(0,0,0,0.3); } .pop{ width:500px; height:500px; position:absolute; left:50%; top:50%; transform: translate(-50%,-50%); border:2px solid red; }
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://www.ezyhdfw.cn/yun/114445.html
方法一: //遮罩層 //內(nèi)容區(qū) .bg{ width:100%; height:100%; left:0; top:0; position:fixed; background:rgba(0,0,0,0.3); } .point{ position:absolute; left:50%; ...
摘要:層疊樣式表二修訂版這是對(duì)作出的官方說明。速查表兩份表來自一份關(guān)于基礎(chǔ)特性,一份關(guān)于布局。核心第一篇一份來自的基礎(chǔ)參考指南簡(jiǎn)寫速查表簡(jiǎn)寫形式參考書使用層疊樣式表基礎(chǔ)指南,包含使用的好處介紹個(gè)方法快速寫成高質(zhì)量的寫出高效的一些提示。 迄今為止,我已經(jīng)收集了100多個(gè)精通CSS的資源,它們能讓你更好地掌握CSS技巧,使你的布局設(shè)計(jì)脫穎而出。 CSS3 資源 20個(gè)學(xué)習(xí)CSS3的有用資源 C...
閱讀 2709·2023-04-25 21:41
閱讀 1794·2021-09-22 15:17
閱讀 2228·2021-09-22 10:02
閱讀 2596·2021-09-10 11:21
閱讀 2733·2019-08-30 15:53
閱讀 1148·2019-08-30 15:44
閱讀 1069·2019-08-30 13:46
閱讀 1393·2019-08-29 18:36