图片和文字垂直居中
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> * { margin: 0; padding: 0; } .box { display: table; } .box>span, .box>div { display: table-cell; vertical-align: middle; line-height: 0 } </style> </head> <body> <div class="box"> <span>dkfjkfdk</span> <div> <img src="img/1.png" alt=""> </div> </div> </body> </html>