html - 为什么我的 flex 列中的最后一个元素没有对齐?
问题描述
这是它的样子:https ://gyazo.com/77de215669cf2d9cd3ca35a0e064c7bf
我不确定为什么最后一个盒子不在中心。这是我的 CSS 代码:
.recipe1{
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
.recipe2{
border-radius: 10px;
box-shadow: 0px 5px 20px rgb(71,71,71);
margin: 20px;
display: flex;
flex-direction: column;
justify-content: space-evenly;
background: white;
align-items: center;
min-width: 50%;
}
HTML:
<div className="recipe1">
<div className="recipe2">
<h1 className="display-4 p-3">{title}</h1>
<ul> {/*Ingredients is an array of objects, so need to iterate through it with map to display*/}
{ingredients.map(ingredient => (
<li className="lead">{ingredient.text}</li>
))}
</ul>
<p>Calories: {Math.floor(calories)}g</p>
<img className={style.image} src={image} alt="Cannot display :("></img>
</div>
</div>
我正在使用 react 和 bootstrap,所以那里还有其他一些看起来不同的东西。
解决方案
推荐阅读
- python - 如何改进我的代码,以便我可以在包含大多数“z”字符的文本文件中找到单词?
- bash - 如何在bash中对2个数组进行排序
- javascript - 如何正确添加 react-i18next
- bash - Inotifywait 仅第一次执行 bash 脚本
- javascript - Javascript XLSX 库解析文件不正确
- python - 如何使用 and 运算符合并 2 个字符串列表
- pandas - Seaborn: Sorting countplot by ascending
- c# - 牢不可破的循环
- google-web-designer - Google Web Designer 图库
- audio - 无法为“ffmpeg”找到合适的输出格式,用于将 mp4 音频与 mp4 音频连接起来