html - 如何让我的 Logo 覆盖蓝色横幅?

标签 html css

How do I get my Logo to overlay the blue banner?

有人可以帮我如何将我的地球标志覆盖在我的蓝色单杠上吗?谢谢!我附上了它的外观照片。我不想失去定位或任何东西。

CSS

.logo {
    display: inline-block;
    width: 100px;
    margin-left: 100px;
    margin-top: 20px;
    max-height: 100%;
}

.title {
    display: inline-block;
    font-size: 40px;
    vertical-align: top;
    margin-top: 50px;
    font-family: arial;
} 

#bannerTitle {
    background: steelblue;
    height: 60px;
    position: relative;
    margin-top: -50px;
    background: linear-gradient(steelblue, steelblue, white);
}

h2 {
    color: white;
    padding-left: 120px;
    padding-top: 11px;
    font-size: 30px;
}

HTML

<img class="logo" src="img/globe.png" alt="">
    <h1 class="title">The Inter<span>net</span></h1>
        <div id="bannerTitle">
            <h2>The World Wide Web</h2>
        </div>

最佳答案

https://www.w3schools.com/cssref/pr_pos_z-index.asp

需要添加z-index

#bannerTitle{
background: steelblue;
height: 60px;
position: relative;
margin-top: -50px;
background: linear-gradient(steelblue,
steelblue, white);
z-index: -1;
}

关于html - 如何让我的 Logo 覆盖蓝色横幅?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44191997/

相关文章:

javascript - ng-view 导致页面崩溃

html - 导航栏水平+垂直居中

javascript - Nivo 响应线图仅响应于变宽,而不是变窄

php - 如何在 cgridview yii 中的 <td> 之后放置一个 <div> 标签?

CSS Div 并排,没有设置宽度

javascript - 按跨度内容排序 ul 列表

html - 无尽的水平拉伸(stretch), child 的宽度未知

javascript - setCustomValidity 的自定义错误避免提交表单

jquery - HTML 正文被 jQuery 偏移,无法在 DOM 中找到原因/来源?

css - 使用 css 时用 %20 替换空格