html - 如何在 html/css 的移动 View 中水平滚动方框?

标签 html css responsive-design media-queries horizontal-scrolling

我有一个在桌面 View 中看起来很完美的网站。我创建了 fiddle以及因此很容易进行更改。

我用来对齐一行中的方 block 的 CSS 代码片段是:

.squares {
  display: flex;
  justify-content: space-between;
  align-items:center;
  padding: 1rem;
  flex-wrap: wrap;
}

.squares .square {
    width: 13%;
    text-align: center;
    height: 150px;
    padding-top: 1%;
    padding-left: 1%;
    padding-right: 1%;
    border-style: solid;
    border-width: 3px;
    border-color: rgb(145, 147, 150);
    border-radius: 10px;
   }



问题陈述:

我想知道应该添加哪些 CSS 代码 here或进行更改,以便我能够水平滚动方框在移动 View 中,类似于以下屏幕截图:

enter image description here

此时,在移动 View 中它适合屏幕但不水平滚动

最佳答案

也尝试改变:

.squares{
  flex-wrap: nowrap;
}
.squares .square{
  flex: 1 0 auto;
}

这可以防止方 block 转到第二行。

关于html - 如何在 html/css 的移动 View 中水平滚动方框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50499051/

相关文章:

python - Django - 管理员自定义字段显示和行为

css - SASS中变量的开关值

html - 以百分比表示的 CSS 布局在 Firefox 中显示较小的右边距

css - HTML 列表中的响应式背景图像问题

html - 响应式侧边栏

javascript - 下拉列表的滚动条

html - 如何滚动位置 :absolute with the bowser scroll?

html - 阿拉伯字体在 IE 11 中不起作用?

jquery - 修复在 Bootstrap 选项卡上无法正常工作的问题

ios - 如何在 Swift 中向响应式网站添加后退按钮