是否可以在父级居中时让子级向左对齐?
我有元素列表。父 block 应居中对齐,子 block 应向左对齐。
现在我也可以将 child 对齐到中心 - JSFIDDLE
.parent {
text-align: center;
}
.child {
width: 100px;
height:100px;
margin:10px;
display:inline-block;
background:#e0e0e0;
}
最佳答案
请试试
.child {
width: 100px;
height:100px;
margin:10px;
float: left;
text-align: left;
background:#e0e0e0;
}
fiddle - http://jsfiddle.net/Dgdhr/82/
关于css - 当 parent 与中心对齐时,将 child 向左对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35473045/