小技巧2 - 负边距居中法
生活随笔
收集整理的這篇文章主要介紹了
小技巧2 - 负边距居中法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
?
負邊距居中法,是比較實用的一種居中方法,屢用不爽
?
?
<!doctype html> <html lang="en"> <head><meta charset="UTF-8"><title>負邊距居中法</title><style type="text/css">body{position: relative;background-color: #f2f2f2;width: 100%;height: 600px;}.demo{background-color: red;width: 200px;height: 50px;position: absolute;left: 50%;top: 50%;margin-left: -100px;margin-top: -25px;}</style> </head> <body><div class="demo"></div> </body> </html>?
轉載于:https://www.cnblogs.com/wangchengb/p/8995399.html
總結
以上是生活随笔為你收集整理的小技巧2 - 负边距居中法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 门对阳台门五帝钱怎么挂才对一边一个吗?
- 下一篇: 东方红拖拉机554挂倒档不走