
中括号与下面内容的垂直对齐
问题:中括号(【】)如何与下面的文本内容垂直对齐?
解决方法:
针对中文符号,第一行使用text-indent进行缩进效果更佳。
div:nth-child(1) {
text-indent: 10px;
}或者,可以给第一行添加负的缩进。
div:nth-child(1) {
text-indent: -10px;
}但是,如果中括号不是总是出现,则需要使用伪类选择器。
div::before {
content: "【";
margin-right: 4px;
}
div:nth-child(2) {
text-indent: 10px;
}这样,每个第二行的文本都会缩进 10px,中括号则始终与下面的文本对齐。










