【发布时间】:2022-01-21 03:16:17
【问题描述】:
大家好!! 我正在努力将此图像放入蓝色背景的 div 中。 图像底部应等于父 div。 我该如何解决这个问题。
提前致谢!!! HTML
<div class="get-experience">
<div class="get-exbg"></div>
<div class="get-extext">
<h2>Get experience from the expert</h2>
<p>
Quid ex eo ortum, tam inportuno tamque crudeli; sin, ut aliquid ex
</p>
<button>Contact Us</button>
</div>
<div class="get-exphoto">
<img src="img/woman.png" alt="" />
<div class="get-excircle"></div>
</div>
</div>
CSS
.get-experience {
width: 100%;
max-width: 1440px;
margin: 40px auto;
display: flex;
overflow: hidden;
position: relative;
height: auto;
}
.get-exbg {
z-index: -1;
overflow: hidden;
position: absolute;
width: 100%;
height: 0;
border-top: 120px solid transparent;
border-right: 50px solid #58bebf;
border-bottom: 25px solid #58bebf;
border-right-width: 1440px;
border-bottom-width: 370px;
}
.get-extext {
color: #fff;
top: 50%;
margin: auto 175px auto 165px;
position: relative;
}
.get-exphoto img {
position: relative;
}
【问题讨论】:
-
margin-top 或垂直对齐应该在父 div 的底部对齐。