让img居中的方法

mac2022-06-30  70

html模板:

<div class="container"> <img src="img/1.png" alt="" style="width: 100px;height: 100px;"> </div> View Code

1.水平垂直居中

  A.转化为表格单元格的形式

.container{ display: table-cell; width: 600px; height: 500px; vertical-align: middle; text-align: center; border: 1px solid black; } View Code

 

转载于:https://www.cnblogs.com/QIQIZAIXIAN/p/6932123.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)