实现效果
单行居中:
多行居左:
实现代码
父元素:
.father {
text-align: center;
}
子元素:
.son {
text-align: left;
display: inline-block;
}
DEMO 代码:
.father {
width: 200px;
height: 100px;
background-color: rgb(117, 231, 247);
text-align: center;
}
.son {
text-align: left;
display: inline-block;
}
<div class="father">
<div class="son">层叠样式表是一种用来表现HTML或XML等文件样式的计算机语言。</div>
<!-- <div class="son">CSS</div> -->
</div>