1.文本垂直居中
? ? ? ? 1.1 Flexbox 布局
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.container {
display: flex;
align-items: center; /* 使用 align-items 屬性垂直居中 */
height: 200px; /* 設(shè)置容器高度 */
border: 1px solid #ccc;
}
</style>
</head>
<body>
<div class="container">
<p>垂直居中文本</p>
</div>
</body>
</html>
????????1.2Grid 布局:
<!DOCTYPE html>
<html lang="en">
<head>
<style>
.container {
display: grid;
place-items: center; /* 使用 place-items 屬性垂直水平居中 */
height: 200px; /* 設(shè)置容器高度 */
border: 1px solid #ccc;
}
</style>
</head>
<body>
<div class="container">
<p>垂直居中文本</p>
</div>
</body>
</html>
2.?左側(cè)border與文字作為導(dǎo)航標(biāo)題
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-789646.html
<div class="header_all">
<div class="header_content" >
<p>{{fatherName}}</p>
</div>
</div>
<style lang="less" scoped>
.header_all{
width: 100%;
height: 100%;
margin: 0.5% 0 0 1%;
}
.header_content{
height: 80%;
max-height: 50px;
display: flex;
align-items: center;
border-left: 10px solid red;
}
p{
font-size:16px;
color: black;
font-weight: 500;
}
</style>
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-789646.html
到了這里,關(guān)于css-文本垂直居中, 左側(cè)border與文字作為導(dǎo)航標(biāo)題的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!