<!DOCTYPE html>
<html lang="en">
<head>
<style>
.container {
display: flex;
align-items: center; /* 使用 align-items 属性垂直居中 */
height: 200px; /* 设置容器高度 */
border: 1px solid #ccc;
}
</style>
</head>
<body>
<div class="container">
<p>垂直居中文本</p>
</div>
</body>
</html>
css-文本垂直居中, 左侧border与文字作为导航标题
本文介绍了如何使用HTML和CSS中的flexbox布局来创建一个200px高的容器,使内部的文本垂直居中显示。
摘要由CSDN通过智能技术生成