在first image中,当文字长度增加时,它会向上移动this image。我怎么能带来这种效果?
使用"自动换行"将该行包装到以下行,这样就没有用了。
此处ALBUMTextContainer用于班级"专辑"。 " count"的位置不要被打扰而不是#34;标题"如果它溢出,应该向上移动。
.album {
margin-top: 1rem;
padding: 0 12px;
position: relative;
}
.ALBUMTextContainer {
position: absolute;
bottom: 0;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), #000000);
width: 352px;
height: 80px;
display: flex;
justify-content: center;
&_details {
word-wrap: break-word;
line-height: 1.34;
text-align: center;
margin-bottom: 20px;
&_name {
width: 330px;
color: #fff;
font-size: 22px;
}
&_count {
color: #ccc;
font-size: 15px;
font-weight: normal;
padding-top: 2px;
}
}
}
<div className="ALBUMTextContainer">
<div className="ALBUMTextContainer_details">
<div className="ALBUMTextContainer_details_name">{title} </div>
<div className="ALBUMTextContainer_details_count">{count}</div>
</div></div>
答案 0 :(得分:0)
设置height:auto;
.ALBUMTextContainer {
position: absolute;
bottom: 0;
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), #000);
width: 352px;
height: auto;
display: flex;
justify-content: center;
}