这是代码。我无法弄清楚如何使图像在div内水平居中。提前谢谢!
.first {
height: 100%;
}
.first img{
width: 100px;
height: 100px;
position: relative;
margin: 0 auto;
}
答案 0 :(得分:0)
.first {
height: 100%;
text-align: center;
}
.first img{
width: 100px;
height: 100px;
position: relative;
display: inline-block; // this line is only required if your img is not already using display: inline-block
}