偏移类不是必需的.
在行上设置text-align:center并在项目上显示:inline-block,你很高兴. (有关居中的更多信息 – 请参阅this article)
如果您需要响应,可以使用flexbox
.row {
width: 100%;
height: 23vw;
text-align: center;
display: flex;
justify-content: center;
}
.item {
text-align: center;
box-sizing: border-box;
padding: 10px;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 20vw;
height: 16vw;
}
img {
width 100%;
height: 100%;
}
.item button {
display: block;
margin-top: 10px;
}
Title
Some button
Title
Some button
Title
Some button
Title
Some button
Title
Some button
Title
Some button
Title
Some button
Title
Some button
Title
Some button
Title
Some button