web文本居中

以下是文本居中代码

点击查看代码
height: 150px;
line-height: 150px;
text-align: center;
实现单文本垂直居中就是将line-height的高度与行高一样 运行代码
点击查看代码

hello

多行文本居中
点击查看代码
height: 120px;
display: flex;
align-items: center;
justify-content: center;
运行代码
点击查看代码

hello
hello

posted @ 2026-07-09 08:06  zhaobin666  阅读(12)  评论(0)    收藏  举报