Reactjs 在div中居中对齐项目
目标:在div中集中对齐项目 如图所示,请注意每只手表都向左移动: 我试图集中呈现productcard中的每个项目 当前,每个productCard\uuu容器都呈现在左侧 以下是我的ProductCard.js代码: 回来 history.push`/product/${id}`> {brand} {name} ${price} …和CSS代码:Reactjs 在div中居中对齐项目,reactjs,Reactjs,目标:在div中集中对齐项目 如图所示,请注意每只手表都向左移动: 我试图集中呈现productcard中的每个项目 当前,每个productCard\uuu容器都呈现在左侧 以下是我的ProductCard.js代码: 回来 history.push`/product/${id}`> {brand} {name} ${price} …和CSS代码: .productcard { margin: 10px; border-radius: 12px; background-color:
.productcard {
margin: 10px;
border-radius: 12px;
background-color: black;
}
.productCard__container {
align-items: center;
}
您可以使用css flex box .产品卡{ 显示器:flex; 证明内容:中心; }
您可以使用css flex box .产品卡{ 显示器:flex; 证明内容:中心; }