html css div img垂直居中
<head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus®"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>Document</title> </head> <style type="text/css"> div{ height:200px; background:#eee; vertical-align:middle; } img{ height:40px; vertical-align:middle; } /* span{ height:100%; display:inline-block; vertical-align:middle; } */ </style> <body> <div> <!-- <span></span> --> <img src="https://www.baidu.com/img/bd_logo1.png" alt="" /> </div> </body>
破罐子互摔