html - 定位卡片而不改变标题
问题描述
我正在使用 Bootstrap 3 制作联系支持页面。我在标题图像的顶部放置了一张卡片,并140px
在卡片上设置了一个填充:
.card-section {
position: relative;
bottom: 140px;
}
标题:“3 hurtige Tips før du ringer til os”现在被推140px
下,我希望标题正好在卡片结束的位置下方。
有人知道我该如何解决吗?
代码很长,所以我只贴了相关代码。请查看整个页面的演示站点。
.mk-page-header {
background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,.7)), url(http://koed.dk/Static/Cms/333780ed-bd2b-4513-9186-af155e172a57.jpg)
no-repeat;
position: relative;
background-size: cover;
}
.page-caption {
padding-top: 170px;
padding-bottom: 174px;
}
.page-title {
font-size: 46px;
line-height: 1;
color: #fff;
font-weight: 600;
text-align: center;
}
.card-section {
position: relative; bottom: 140px;
}
.card-block {
padding: 40px 80px 10px 80px;
box-shadow: 20px 20px 50px grey;
}
.section-title {
margin-bottom: 60px;
}
<div class="mk-page-header">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="page-caption">
<h1 class="page-title">KONTAKT VORES SUPPORT</h1>
</div>
</div>
</div>
</div>
</div>
<!-- Card Section -->
<div class="card-section">
<div class="container">
<div class="card-block" style="background-color: white;">
<div class="contact-icon row">
<div class="section-title">
<h2>HAR DU SPØRGSMÅL?</h2>
<p>KOED har siden starten i 1993 beskæftiget sig udelukkende med BMW, og denne omfattende erfaring og viden vil vi gerne dele med dig. Vores store viden om BMW gør os i stand til at give dig svar på næsten enhver forespørgsel om mærket, hvad enten det handler om reservedele, tilbehør, hjælp til specialopgaver, guides til reparationer og meget mere.</p>
</div>
<div class="col-sm-12">
<div class="contact-icon row">
<div class="col-xs-4">
<img class="img-responsive-mk center-block" src="https://koed.dk/Static/Cms/6dfe32ba-7cff-443d-ab73-016dd2f6dca7.jpg"></img>
<h3 style="text-align:center;">Ring til os</h3>
</div>
<div class="col-xs-4">
<img class="img-responsive-mk center-block" src="https://koed.dk/Static/Cms/57e5b8a2-871d-487f-90e4-ae8b8d170ca2.jpg"></img>
<h3 style="text-align:center;">Skriv til os</h3>
</div>
<div class="col-xs-4">
<img class="img-responsive-mk center-block" src="https://koed.dk/Static/Cms/3caa853e-7da3-4e1f-9aa2-a04ee71901c9.jpg"></img>
<h3 style="text-align:center;">Facebook</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
解决方案
最简单的解决方案是添加margin-bottom: -140px;
到您已经拥有的 .card-section 中bottom: 140px;
。
但这不是唯一的解决方案。
推荐阅读
- java - Webscraping 使用 jsoup html 解析问题
- xquery - 具有命名空间的文档上的路径表达式
- rust - 超时后在 Rust 中中止评估
- python - 倒计时/计时器在 kivy/python 中更改屏幕
- javascript - 循环遍历 javaScript 对象返回值为 0 和 false 的“未定义”
- java - onActivityResult 没有从适配器调用
- django - json.loads 将有效的 JSON 转换为无效的 JSON
- r - 安装 R 包卡在 g++ -std=gnu++11?
- jgrapht - 如何使用 jgrapht 使用 sugraph 创建图形
- php - 有没有办法在不丢失标记的情况下将 html 分配给 php 变量?