【发布时间】:2022-08-08 01:24:52
【问题描述】:
我正在用 HTML 和 CSS 制作一些“卡片”,并且我有一个容器,又名。家长div:
.resources {
display: flex;
background-color: #000000;
margin-top: 1vh;
padding: 8px 8px 0px 8px;
flex-direction: column;
border-radius: 5px;
}
.resources .resource {
width: 100%;
height: auto;
display: flex;
margin: auto;
margin-bottom: 8px;
cursor: pointer;
background-color: #010101;
padding: 5px 5px 5px 5px;
border-radius: 5px;
}
.resources .resource .icon {
width: 4vh;
height: 4vh;
border-radius: 5px;
margin: auto;
}
.resources .resource .text {
text-align: left;
margin-left: 5px;
float: left;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width: 90%;
}
.resources .resource .text h6 {
font-size: 13px;
color: #ffffff;
}
.resources .resource .text p {
font-size: 12px;
color: #ffffff;
}
<div class=\"resources\">
<div class=\"resource\">
<img class=\"icon\" src=\"...\">
<div class=\"text\">
<h6>title</h6>
<p>lorem ipsum</p>
</div>
</div>
</div>
基本上一切正常。这是我所知道的:
但是子卡(资源)的末尾与父 div(资源)重叠,我不希望它溢出,我希望它具有相等的填充并留在父 div 中。就像是 :
希望这对任何提前提供帮助的人都有意义并感谢。