标签:cal inline body lex doc img nbsp html ddl
第一种
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> div{height:100px;width:100px;text-align: center;} img{vertical-align: middle;display: inline-block;} span{height:100%;width:0;vertical-align: middle;display: inline-block;} </style> </head> <body> <div> <img src="" /> <span></span> </div> </body> </html>
第二种
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> div { display:flex } img{ margin:auto; } </style> </head> <body> <div> <img> </div> </body> </html>
标签:cal inline body lex doc img nbsp html ddl
原文地址:http://www.cnblogs.com/zhangshuda/p/7639847.html