【发布时间】:2019-05-16 18:33:01
【问题描述】:
我试图让我的子 div 部分一直到父 div 部分的顶部和底部。转到此示例 URL 的底部(加拿大国旗站立桨板运动员所在的位置):https://www.lakeshoresup.com/product/pathfinder/ 基本上,如果我将宽度设置为大于 41%,我会得到一个不会到达该部分顶部和底部的小区域。
代码:
<div class="hero__container container">
<div class="hero__content-wrapper" style="background-color: rgba(0,0,0,0.2); flex: 60% ; max-width: 60%;">
<h1 class="hero__title hero__title--big">
Adrift in the Canadian Rockies</h1>
<p class="hero__content hero__content--medium">
Jake and Lyndsay embark on a Lakeshore adventure with their inflatable paddleboards. </p>
<div class="primary-link">
<a href="https://www.lakeshoresup.com/2015/07/28/adrift-in-the-canadian-rockies-with-jake-lyndsay-part-1/" class="hero__primary-link btn" target="_blank">
Read Their Story </a>
</div>
</div>
</div>
CSS
.hero--right .container {
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
}
.hero__content-wrapper {
padding-left: 20px;
padding-right: 20px;
display: table-cell;
vertical-align: top;
}
我尝试将min-height:760px 添加到有效但不是动态的css 中。当网站转到移动设备或滑块大小不同时,它会破坏图像。
有没有一种动态的方式让子盒子(.hero__content-wrapper)总是延伸到父盒子(.hero__container)的顶部?
这是我可以使用下面的 CSS 并让它在所有浏览器中运行的东西,还是有更好的方法来做到这一点?
height: -moz-available;
height: -webkit-fill-available;
height: fill-available;
【问题讨论】: