設置容器的浮動方式為絕對定位
然后確定容器的寬高 比如寬500 高 300 的層
然后設置層的外邊距
1 Div { 2 width:500px ; 3 height:300px; 4 margin: -150px 0 0 -250px; 5 position: absolute; 6 left:50%; 7 top:50%; 8 background-color: #000; 9 }
設置容器的浮動方式為絕對定位
然后確定容器的寬高 比如寬500 高 300 的層
然后設置層的外邊距
1 Div { 2 width:500px ; 3 height:300px; 4 margin: -150px 0 0 -250px; 5 position: absolute; 6 left:50%; 7 top:50%; 8 background-color: #000; 9 }
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。