gpt4 book ai didi

html - 在 div 中居中 h2 - 非常基础

转载 作者:搜寻专家 更新时间:2023-10-31 23:07:30 26 4
gpt4 key购买 nike

我想将 h2 居中放置在#top 中,但垂直对齐中间不工作相同的自动边距...我不知道该怎么做!

#top {
display: block;
position: relative;
height: 100px;
background-color: rgba(89,144,222,.6);
}
#top h2{
text-shadow: 2px 2px black;
text-align: center;
color: white;
font-family:"Impact";
font-size: 50px;
}

效果是 - enter image description here

最佳答案

设置line-height:100px; vertical-align:middle 在#top 上。

关于html - 在 div 中居中 h2 - 非常基础,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15589785/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com