更新時間:2020年08月13日17時39分 來源:傳智播客 瀏覽次數(shù):
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style tpye="text/css"> body{ background:#000 } div{ width: 900px; height: 800px; background:deeppink; display: flex; align-items: center; } div img{ width: 579px; height: 282px; align-items: center; } </style> </head> <body> <div> <img src="html.png" alt=""> </div> </body> </html>
看下效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style tpye="text/css"> body{ background: #bbb; } div{ display: table; width: 900px; height: 700px; background: #f3f3f3; display: table-cell; vertical-align: middle; } div img{ width: 282px; } </style> </head> <body> <div> <img src="html.png" alt=""> </div> </body> </html>