gpt4 book ai didi

html - Div 填充背景颜色作为顶部栏

转载 作者:行者123 更新时间:2023-11-28 18:31:07 25 4
gpt4 key购买 nike

我正在尝试显示中间带有 Logo 图像的水平顶部栏。图片位于页面左侧,垂直居中。我如何在顶部栏的中心获得图像?这是我的代码:

<div class='topbar'>
<img src="../../img/headerlogo.png" class="topbarlogo"/>
</div>

CSS:

div.topbar {
height: 80px;
width: 100%;
background-color: #000000;
margin-top: 0px;

}
.topbarlogo {
display: block;
position: absolute;
}

最佳答案

你在 css 中拼错了你的类,'topbor' 应该是 topbar。

另外补充:-

margin-left: auto;
margin-right: auto;

关于html - Div 填充背景颜色作为顶部栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14308307/

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