html - 图像未对齐
问题描述
我有一个问题,每当我尝试排列我的图像时。好像没有排队。我不知道这是否是图像问题,但我可以使用一些帮助。我对此很陌生,所以如果我觉得这是一个简单的解决方法,我深表歉意。
.portfolio-item-wrapper2 {
display: flex;
grid-template-columns: 1fr 1fr 1fr;
}
.portfolio-item-wrapper2 {
position: relative;
}
.portfolio-img-background2 {
height: 350px;
width: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.img-text-wrapper2 {
position: absolute;
top: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
text-align: center;
padding-left: 100px;
padding-right: 100px;
}
<div class="content=wrapper2">
<div class="portfolio-items-wrapper2">
<div class="portfolio-item-wrapper2">
<div class="portfolio-img-background2">
<div class="img-text-wrapper2">
<div class="logo-wrapper2">
<img src="\\kcfs04\StudentHome\20023600\Downloads\C.png" />
</div>
</div>
</div>
</div>
</div>
</div>
<div class="content=wrapper3">
<div class="portfolio-items-wrapper3">
<div class="portfolio-item-wrapper3">
<div class="portfolio-img-background3">
<div class="img-text-wrapper3">
<div class="logo-wrapper3">
<img src="\\kcfs04\StudentHome\20023600\Downloads\G.png" />
</div>
</div>
</div>
</div>
</div>
</div>
我需要它们并排放置,因为我将在下面添加更多内容,但位置相同。
解决方案
首先,不要同时使用 css grid 和 flexbox,你可以使用 position relative 属性
推荐阅读
- r - 通过 R 中的光栅循环保存/存储
- javascript - 角度路由 - 当它是应用程序的默认路径时,尝试刷新相同的路由不起作用
- ios - 如果标题文本为空或未分配,如何隐藏 uibutton?
- javascript - 技术解释为什么反引号不适用于导入语句
- python - 想要将 dataset.info() 结果存储到 Python 中的数据框中
- c# - 发布模式下的 Smartsheet C Sharp SDK DLL 错误
- validation - 如何防止 p:inputText 中出现多个 ..(dots)、ee、++(plus) 和 --(minus) 符号
- python - <
> P372 例子8-19 为什么只存在最后一个元素? - python - 如何抓住第二个“跨度”?(在 python 中制作网络爬虫)
- c++ - 使用迭代器时使用++和+1的区别