css在盒子中垂直居中和固定居中
生活随笔
收集整理的這篇文章主要介紹了
css在盒子中垂直居中和固定居中
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
頂部固定居中
<div class="w960 fixed">我是固定的</div>.w960{ width: 960px; margin:0 auto; } .fixed{ position: absolute; top:0; left: 0; right: 0; height: 90px; background: #ececec; }垂直居中
<div id="box"><div class="son">ssss</div></div>#box {width: 600px;height: 500px;position: relative;border: 1px solid #f00; } .son {width: 100px;height: 100px;border: 1px solid #ecc;position: absolute;left: 50%;margin-left: -50px;top: 50%;margin-top: -50px; }?
轉載于:https://www.cnblogs.com/tl542475736/p/6145088.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的css在盒子中垂直居中和固定居中的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 射命丸文 (Standard IO)
- 下一篇: HTML5中的时间类型,另外EL表达式的