【发布时间】:2020-07-16 02:07:00
【问题描述】:
我在一个项目中有这个导航栏:
<nav class="navbar navbar-dark bg-dark">
<a class="navbar-brand" href="#">
<img th:src="@{/img/bootstrap-solid.svg}" width="30" height="30" class="d-inline-block align-top" alt="">
Kleber App Store
</a>
</nav>
而不是这个:
<img th:src="@{/img/bootstrap-solid.svg}" width="30" height="30" class="d-inline-block align-top" alt="">
Kleber App Store
我想要这样的东西:
<img th:src="@{/img/bootstrap-solid.svg}" width="120" height="240" class="d-inline-block align-top" alt="Kleber App Store">
但不改变导航栏的高度(图像应在开始时与导航栏重叠,并留出下方区域,如级联)。
我已经尝试在 stackoverflow 上按照一些答案添加 style="position: absolute;",但是使用此解决方案,图像显示时与顶部有一点差距,在导航栏下方区域的 list-group 后面。
有人知道怎么解决吗?
【问题讨论】:
-
嗨 Kleber,您能否在您的问题中添加一个演示
-
你是否尝试过 position: absolute solution with top:0 on img and margin-bottom: 120px;在导航栏上?
-
刚刚做了。同样的结果:jsfiddle.net/klebermo/wq84623n/12
-
好吧,差距仍然存在。但由于导航栏和导航栏品牌上的填充,它在那里。所以如果你要重置它们(padding-top:0;)你应该没问题jsfiddle.net/m7k6ozhu
标签: html css image twitter-bootstrap