<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <style> div{ position:relative; width:600px; height:600px; background-color: red; } p{ position:absolute; width:200px; height:200px; top:50%; left:50%; background-color: #fff; transform:translate(-50%,-50%); } </style> <body> <div> <p></p> </div> </body> </html>
盒子居中效果
最新推荐文章于 2024-07-14 12:57:13 发布