<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css">*{margin:0 ;padding:0; } </style> </head> <body> <style type="text/css">body{ width:100vw;height:100vh;display:table-cell;vertical-align:middle;text-align:center; }div{display:inline-block; } </style> <div class="child">内容 内容 内容 内容 内容 内容 内容 内容 内容 </div> </body> </html>
display: table-cell; 元素上下左右居中,子元素无宽高
免责声明:文章转载自《display: table-cell; 元素上下左右居中,子元素无宽高》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=