When employing CSS Grid, the content fails to wrap on mobile devices

My issue is best represented through a gif. Here is the problem:

https://i.sstatic.net/UdfjT.jpg

When viewing on smaller screens, the content should wrap properly but instead, I encounter a horizontal scrollbar.

For reference, here is a codepen link.

You can also view the actual code below as required by StackOverflow guidelines:

HTML

<div class="l-grid">
  <header>
    <h1 class="logo"><span class="logo__brand-color">M</span>y Site</h1>
  </header>

    /* HTML CODE OMITTED FOR BREVITY */

CSS

* {
  margin: 0;
  padding: 0;
  text-decoration: none;
  list-style: none;
  border: none;
  box-sizing: border-box;
}

   /* CSS STYLES OMITTED FOR BREVITY */

I have checked for padding or margin issues using developer tools, but couldn't find any. Any suggestions would be greatly appreciated!

Answer №1

To improve responsiveness, consider reducing the number in the autofill property like so: With 100px wide columns, a minimum of 500px total for 5 columns is recommended to maintain optimal responsiveness.

.footer-nav {
    display: grid;
    grid-template-columns: repeat(5, 64px);
    justify-content: center;
    align-self: flex-start;
}

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

Tap on the menu icon / Swipe on the screen to move between pages

I recently created a website, but I'm looking to add a unique feature where users can click and drag horizontally to navigate between pages. This means that when dragging from right to left, the page turns to the next menu page. Similarly, dragging fr ...

Tips for aligning ticks to the left on a d3 bar chart

i recently finished creating a stacked bar graph with varying tick lengths on the y-axis side. my goal is to align the text within the ticks to the left, similar to this example: http://jsfiddle.net/2khbceut/2/ here is the HTML: <title>Diverging Sta ...

Connect the CSS active state to a JavaScript event

.el:active{ background:red; } Is there a way to associate the above CSS active state with a JavaScript event, like this: $('.el').on('active', function(){ img.show(); }); I want the image to remain visible when el is presse ...

Adding a MySQL-PHP combination programmatically

Currently, I am working on a custom HTML page that sends data to PHP variables which are then utilized to generate customized SQL queries. function load_table($db, $old_table, $startRow, $nameColumn, $ipColumn, $addressColumn, $cityColumn, $stateColumn, $ ...

What is the best way to showcase top-rated posts from my feed of posts?

I have a basic PHP script that allows users to post without logging in. Once they submit their posts, the posts are displayed below in a feed similar to Facebook's news feed. I'm now looking to extract the three most liked posts and display them ...

Tips for utilizing vulnerable web scripts on SSL-enabled pages

After implementing SSL to secure my pages, I encountered an issue where one of my scripts no longer functions properly. Specifically, I had a script on my page that was used to display the visit count from this website. Previously, it was functioning fla ...

Is there a way for me to scroll to #target but minus 100px from its position

Trying to implement: <a href="#target">Details</a> <div id="target">asd...</div> The issue is, I also have a top popup menu that overlaps. Is there a way to adjust the JavaScript (I am already using bootstrap and jQuery libraries ...

What could be causing the issue of my CSS file not properly connecting with my HTML files in Django?

I am facing an issue with linking the CSS file to the HTML file in my code. Despite not showing any errors, there is no effect on my webpage. The files I have included are settings.py, base.html, and base.css. Additionally, my static folder is located outs ...

Ways to update the text alongside a slider form with JavaScript

I am currently working on a project using html and js function slide(){ let v= document.getElementById("slide_inner"); document.getElementById("slider").textContent=v.value; } <form id="slider"> <label for="slide_inner"&g ...

Steps for splitting a numbered list and adding an image above each item:

I have a challenge I'm trying to tackle with my list: My goal is to create a long, numbered list that is divided into different sections I also want to include an image within each list item and have it display above the numbered title of the sectio ...

creating dynamic JavaScript elements within a parent div container on the client side

I've been working on a JavaScript code that generates new div elements every few milliseconds and stacks them up. However, I'm facing an issue where the script is running outside of any specific div container. Is using document.getElementById("pa ...

Looking to refresh a model within an AngularJS directive by utilizing a touchscreen interface

Utilizing ng-repeat allows me to generate a series of input fields within a form: <div class="col-sm-6 input" data-ng-repeat="v in values"> <div data-prefix-numeric-input data-prefix-name="{{ v.name }}"> <input type="number" id= ...

Tackling the sticky header problem with in-browser anchoring and CSS dynamic height restrictions

I am experimenting with a unique combination of a Pure CSS in-page anchoring solution using scroll-behavior: smooth and scroll-margin-top settings, along with a sticky header for in-page navigation. By utilizing IntersectionObserver, I can identify when t ...

Is it possible to include number padding in a Bootstrap number input field?

When using an input box like this: <input type="number" class="form-control" value="00001" /> Is there a way to make it so that when the arrow up key is pressed, it changes to 00002 instead of just 2? https://i.sstati ...

On the initial click of the button, the color will switch, and on the subsequent click,

I have created a basic HTML structure with a paragraph and a button. Upon clicking the button, I need different actions to take place. Specifically, on the first click, I want to change the color of the paragraph. On the second click, I aim to alter the fo ...

The styles within a media query are not being successfully implemented

update: issue resolved. I discovered that there was a lingering media query in the css file that was meant to be removed. Also, I corrected some errors in the code. Thank you all for your help – it's now working perfectly. I have a set of html and ...

"Troubleshooting a jittery React sticky header during scrolling: Dealing with IntersectionObserver and CSS

My current project involves implementing a sticky header in a React application using the Carbon framework. The goal is to have a sticky header with a bottom border when users scroll up, providing context for their viewing experience. However, when they sc ...

Adding substantial sections of HTML without any adjustments

While I am working on DOM manipulation, I have encountered the need to insert large blocks of HTML. I am looking for a more efficient way to do this rather than relying on concatenation or creating a messy code structure. Consider the simple code snippet b ...

What is the best approach for promoting reusability in Angular: creating a new CSS class or a new component?

I have a div with a set of CSS properties that are essential to my application. These properties will be reused across multiple pages and components. <div style="display: flex; flex-direction: column; height: 100%"> //inner html will vary based on c ...

Change the color of unordered list items only at the same level

Hey there! I'm working with this HTML code: <ul id="nav" class="nav-1"> <li><a href="#">Loans</a></li> <li><a href="#">Bancassurance</a> <ul class="nav-2"> <li><a href="#"&g ...