Changing Column Heights for Mobile Devices using @media Queries

This specific CSS code is designed for a responsive template, creating three columns on desktops/laptops/iPads and stacking them for phones. However, there is an issue when viewing this layout on mobile devices where the stacked panels are fixed in height. I am currently experimenting with various CSS solutions to automatically adjust the panel length on mobile views when additional content is added.


       * {
         box-sizing: border-box;
       }

       /* Create three equal columns that float 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%;
         }
       }        

Answer №1

Do you anticipate the column expanding on its own? Have you experimented with setting height to auto?

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the steps to export a JSON response to an Excel file using JavaScript?

I am new to working with AJAX and currently facing a challenge. I need to create a button that will post form data to a URL (API) that returns a JSON response like this: { "employee": { "name": "sonoo", "salary": 5600 ...

Guide to enabling picklist editing in the specified component within an Angular application

Currently utilizing the p-picklist component and looking to customize the displayed data in the target list span. You can find the source code at: Is there a way to enable editing of the product name within the target list? <p-pickList [source]=&quo ...

Unveil as you scroll - ScrollMagic

I am working on a skill chart that dynamically fills when the document loads. I am exploring the possibility of using ScrollMagic to animate the chart filling as the user scrolls down. After trying various combinations of classes and pseudo-classes in the ...

Django Accordion Table Template

I have a Django model that populates a table with objects from a database. What I'm trying to achieve is, when a row in the table is clicked, to use JS or JQuery to accordion a table of objects that are connected as foreign keys to the main object. A ...

React state update not triggering a component re-render

I've been attempting to toggle the visibility of a div by clicking on another div, but I'm encountering an issue. The div becomes invisible on the first click only if it was visible initially. After that, it remains invisible and does not update. ...

Encountering issues with website optimization on Google Page Speed Insights and facing compatibility problems on a specific website I designed

I attempted to analyze the performance of my website using Google Page Speed Insights and encountered an error message. I have tried looking for a solution without success. Interestingly, when I tested other websites that I manage, everything worked just ...

Adjusting the Height of a Div Using a Single Button

Seeking help to make a div expand and then shrink with one button click. I've tried various methods but the div won't change size. Can someone guide me on why this is happening? Here is the code, CSS, and HTML for my latest attempt: $("dasButto ...

Tips for customizing the color of the select drop down arrow component:

Is there a way to change the color of the select drop down box arrow part? It needs to be compatible with IE9, Firefox, and other browsers. Currently, the drop down box looks like this: I would like the arrow part to have this appearance: I believe this ...

Tips for positioning an asp.net Button alongside other elements in a form by making use of Bootstrap styling

Looking to revamp the style of my ASP.NET Web Forms project with the latest version of Bootstrap. Having trouble aligning an ASP.NET Button control horizontally with other controls in the form, as seen in this snapshot: https://i.sstatic.net/IVRKo.png Her ...

Guide on deleting files from WordPress Media Library directly using PHP in the frontend

I have searched various sources while creating my current code, but I have yet to find the answer to this question: Link 1 Link 2 Link 3 Link 4 Creating a file management system where admin access is restricted from WordPress. They will manage files th ...

Adjust the placement of the div dynamically in response to the positioning of another div tag

I have an icon that resembles a chat bubble. If the position of the icon is not fixed, how can I display the chat bubble relative to the icon and adjust its position dynamically based on the icon's location? See image here #logowrap{ padding: 8px ...

What sets apart auto, 0, and no z-index values?

Can you explain the distinctions between the following: z-index: auto z-index: 0 the absence of z-index In all scenarios mentioned, we have a container div that contains two inner divs, named div1 and div2, with respective z-index values of 9 and 10. T ...

Increase the width of paragraph by adding white-space padding

I am attempting to control the number of characters in a paragraph to a specific limit. If the text is shorter, I want to add whitespace padding, and if it exceeds the limit, I will truncate it with an ellipsis. All containers containing paragraphs should ...

What is the process of displaying data from a MySQL database on a label using PHP?

I am seeking a way to retrieve form labels from my Mysql database in order to efficiently display them in any language using select statement. Although I have attempted this method, it has proven difficult due to the various languages involved. A ...

Utilize GeoJSON to showcase multiple features in a convenient table format

I am currently facing a challenge in displaying all the features from a GeoJSON file in a tabular format on a website. Despite creating a Leaflet map that successfully shows all the locations from the GeoJSON file, I am struggling to proceed further. My g ...

What is the best way to consolidate multiple JS files into one main file that I can easily reference in my HTML code?

I've dedicated countless hours to watching videos and compiling a comprehensive library of assets, similar to p5.js (I'm especially fond of Dan Shiffman's content). I now have numerous files for various functions - init.js, dom.js, drawing.j ...

Traversing hrefs inside list elements with Python Selenium

When parsing a webpage with an organization structure like the one below: <nav class="sidebar-main"> <div class="sidebar">Found 3 targets</div> <ul><li><a href="#target1" class="current"><span>target1& ...

No routes were found that match: ""

app.routes.ts import { ModuleWithProviders } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { PushComponent } from './push/push.component'; const appRoutes: Routes = [ { path: ...

Conceal image and substitute with a different image using JavaScript

My query pertains to JavaScript: how can I create an effect where clicking the jump-down button opens a text box and causes the button to change direction and rotate? I am considering using two photos - one hides when the jump-down button is clicked, and ...

Get rid of any empty space in the image preview icon

Is there a way to eliminate the white space that appears when mixing landscape and portrait images? I want the images to move up and fill the space, even if they don't align perfectly. Additionally, I would like the images to resize based on the scal ...