css - 连续 3 个元素与 flexbox

标签 css flexbox

这是我的第一个问题。我是一家网店的二级运算符(operator)。我有个问题。当购物车中添加了 3 件商品时,它们在第一行显示 2 个,在第二行显示 1 个。我试着把它们放在同一行。

元素类->产品内

后面三项类->products.columns-3

我使用此代码,但没有任何反应。

ul.products.columns-3{
display: flex;
background-color: white;
flex-direction: row;
justify-content: center;
}
div.product-inner{
flex: 0 0 33.3333%;
}

你能帮忙吗?谢谢

最佳答案

ul.products.columns-3{
  display: flex;
  background-color: white;
  flex-direction: row;
  justify-content: center;
}
div.product-inner{
  border: 1px solid green;
  flex: 0 0 33.3333%;
}
<ul class="products columns-3">
  <div class="product-inner">PRODUCT 1</div>
  <div class="product-inner">PRODUCT 2</div>
  <div class="product-inner">PRODUCT 3</div>
      
</ul>

错误与您提供的代码无关,它连续显示三个元素。 正如您所说,它是 Wordress 中的 style.css,应用了任何其他样式都会困扰您。

关于css - 连续 3 个元素与 flexbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50843760/

相关文章:

javascript - 选择具有其他类名称的附近表行并切换类

css - Flexbox 选项卡式菜单 : right side dropdown cut off screen

html - 文本卡在 Div 底部

html - 使用 flexbox 包装错误

html - 高度为 div 的 100%

html - flex 盒子 |使用动态大小的 flexbox 获得 “space-between” 的效果

html - CSS中带有em单位的响应宽度

javascript - Foundation 移动菜单不会出现在小屏幕上

html - 如何将整个图像放入 Bootstrap Carousel 中?

html - 图像未在 div 内对齐