div頁面居中方法


#xx{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}

transform屬性應用於元素的2D或3D轉換,這個屬性允許你將元素旋轉,縮放,移動,傾斜等。

講解:https://www.runoob.com/cssref/css3-pr-transform.html

示例:https://c.runoob.com/codedemo/3391


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM