1. 程式人生 > >css絕對居中img

css絕對居中img

pre vertical vertica div 居中 html enter ddl ica

html:

<div  id="imgs">
    <img src="http://pic.616pic.com/ys_b_img/00/03/60/Kt6QwnlaEu.jpg" >
  </div>

  

css:

#imgs {
        width: 100vw;
        height: 100vh;
        display:table-cell;
        text-align:center;
        vertical-align:middle;
      }
      img{
        width: 100px;
        height: 100px;
      }

  

css絕對居中img