DIV居中

xiaoxiao2021-02-28  88

<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <style>         #div1{             width: 300px;             height: 300px;             background-color: red;             position: relative;         }         #div2{             width: 200px;             height: 200px;             background-color: orange;             position: absolute;             left: 50%;             margin-left: -100px;             top: 50%;             margin-top: -100px;         }     </style>     <title>DIV居中</title> </head> <body> <div id="div1">     <div id="div2">     </div> </div> </body> </html>
转载请注明原文地址: https://www.6miu.com/read-72838.html

最新回复(0)