html - 为移动设备调整堆叠列的高度 (@media)

标签 html css media-queries

下面的 CSS 代码非常适合响应式模板。它在台式机/笔记本电脑/iPad 上创建三列,并将这些列堆叠起来用于手机等。

但是在移动设备上查看时,堆叠面板的高度是固定的。我需要移动 View 面板在添加更多内容时自动加长。今天一直在尝试各种不同的 CSS 解决方案,但还没有成功。

       * {
         box-sizing: border-box;
       }


       /* Create three equal columns that floats next to each other */

       .columntop {
          float: left;
          width: 33.33%;
          padding: 10px;
       }

       .column {
          float: left;
          width: 33.33%;
          padding: 10px;
          height: 1000px; /* This controls desktop/laptop views only */
       }

       /* Clear floats after the columns */
       .row:after {
          content: "";
          display: table;
          clear: both;
       }

       /* Responsive layout - makes the three columns stack on top of each other instead of next to each other */
       @media screen and (max-width: 600px) {
         .column {
            width: 100%;
         }
       }        

最佳答案

您是否希望列自动扩展? 你试过高度:自动吗?

@media screen and (max-width: 600px) {
.column {
   width: 100%;
   height: auto;
   }
}       

关于html - 为移动设备调整堆叠列的高度 (@media),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52322056/

相关文章:

html - 选择框中选项的直通 css 样式在 Google Chrome 上不起作用,但在 Firefox 上运行良好

html - 如何与 li last-child 在同一行中创建水平线

html - 具有 z-index 子对象的对象

html - 强制较小的屏幕缩放到较大的分辨率?

html - 用于流体布局的 CSS 列堆叠?

javascript - 将背景图片 url 分配给模板中的 div

javascript - Firefox 在表格单元格中的绝对位置

html - css 背景图像基本失败

html - 混合使用最小宽度和最大宽度媒体查询时遇到问题?

html - 在媒体查询中重置 CSS