1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .root{ width: 600px; height: 600px; background-color: blue; margin: 0 auto; position: relative; } .one{ width: 300px; height: 300px; background-color: black; position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin: auto; } </style> </head> <body> <div class="root"> <div class="one"></div> </div> </body> </html>
|