Display issue with grid-template-column not appearing

My grid column isn't working in my Christmas matching game project. I'm trying to create additional card columns using grid template columns, but the other three columns are not displaying as intended. They should be positioned right next to "Time: 100", but they are not appearing. I have double-checked for any spelling errors and everything seems correct. Can someone please help me identify what I am missing?

<!DOCTYPE html>
<html lang="en">
<head>
<link href="style.css" rel="stylesheet">
<title>Santa's Matching Game</title>

</head>
<body>

    <h1 class="page-title">Santa's Matching Game</h1>
    <!-- Game Stuff Besides Cards -->
    <div class="game-container">
        <div class="game-info-container">
            <div class="game-info">
                Time: <span id="time-remaining">100</span>
            </div>
            <div class="game-info">
                Flips: <span id="flips">0</span>
            </div>
    <!-- Cards -->
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>
            <div class="card"></div>

        </div>
    </div>

</body>  

</html>
@font-face {
    font-family: "Dancing-Bold";
    src: url("Assets/Fonts/Dancing-Bold.ttf") format('truetype');

}


@font-face {
    font-family: "MofC-Bold";
    src: url("Assets/Fonts/MofC-Bold.ttf") format('truetype');

}


* {
    box-sizing: border-box;
}


html {
    min-height: 100vh;
}

body {
    margin: 0;
    background: radial-gradient(#f2f3f8,#58b69b);
}

.page-title {
    color:aliceblue;
    font-family: MofC-Bold, serif;
    font-weight: normal;
    text-align: center;
    font-size: 6em;
}

.game-info {
    color: aliceblue;
    font-size: 4em;
    font-family: Dancing-Bold, serif;
}

.game-container {
    display: grid;
    grid-template-columns: repeat(4, auto);
    grid-gap: 10px;
}

.card {
    background-color: #d33943;
    height: 175px;
    width: 125px;
}

This is my first time posting on Stack Overflow, so I hope I followed all the guidelines correctly.

Answer №1

It seems like the grid is only working with one child element, the game-info-container. Try removing that element and the grid should function properly.

@font-face {
  font-family: "Dancing-Bold";
  src: url("Assets/Fonts/Dancing-Bold.ttf") format('truetype');

}


@font-face {
  font-family: "MofC-Bold";
  src: url("Assets/Fonts/MofC-Bold.ttf") format('truetype');

}


* {
  box-sizing: border-box;
}


html {
  min-height: 100vh;
}

body {
  margin: 0;
  background: radial-gradient(#f2f3f8, #58b69b);
}

.page-title {
  color: aliceblue;
  font-family: MofC-Bold, serif;
  font-weight: normal;
  text-align: center;
  font-size: 6em;
}

.game-info {
  color: aliceblue;
  font-size: 4em;
  font-family: Dancing-Bold, serif;
}

.game-container {
  display: grid;
  grid-template-columns: repeat(4, auto);
  grid-gap: 10px;
}

.card {
  background-color: #d33943;
  height: 175px;
  width: 125px;
}
<h1 class="page-title">Santa's Matching Game</h1>
<!-- Game Stuff Besides Cards -->
<div class="game-container">
  <div class="game-info">
    Time: <span id="time-remaining">100</span>
  </div>
  <div class="game-info">
    Flips: <span id="flips">0</span>
  </div>
  <!-- Cards -->
  <div class="card"></div>
  <div class="card"</div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>

</div>

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

The Google map is failing to load on the webpage

My id="ieatmaps" is set up to call the googlemaps.js, but for some reason, it's not displaying correctly. I must be missing something. function initMap() { var map = new google.maps.Map(document.getElementById('ieatmaps'), { c ...

Ways to turn off Bootstrap links hover background color?

I recently added a Bootstrap menu to my website that I'm currently working on. I am curious about how to disable the hover background color for Bootstrap links. Here's the situation: Below is an example of the menu I implemented: Currently, whe ...

In IE8, displaying an element with jQuery does not cause the footer to be pushed down

I've tried various methods to solve this issue, but none have been successful so far. To better illustrate my problem, I have created a FIDDLE. When the button is clicked, a hidden element is displayed. However, it does not adjust the footer position ...

Is there a way to mimic disabled input fields?

Is there a way to simulate input being disabled without actually changing the value in the input field, but still have that value sent with POST using a form? <input class="dis" type="text" disabled="disabled" value="111"> <input class="no" type= ...

Achieve full height Bootstrap styling by nesting it inside a row div

Is there a way to make the height of the left sidebar div equal to 100% within a row, based on the height of the right content? I have tried setting the height to 100%, but it doesn't seem to work. Any advice would be appreciated. <body> < ...

How to efficiently pass multiple inputs from an HTML form to a controller in AngularJS using a single ng

Currently, I have multiple input text boxes in my HTML and I need to send their values to my controller to add them to an object. The challenge I'm facing is figuring out how to pass more than one value using just one ng-model. In my HTML code, I have ...

Improve the performance of my website and resolve the zooming problem

Trying my hand at teaching myself jquery and creating a decent layout. I believe what I have done is acceptable, but I still have some questions. This is my first attempt at jquery without copying someone else's work. I've aimed to keep it relev ...

SCSS: When hovering over one div, display a different div

My goal is to display the elements in another div when hovering over a specific div. However, my current code does not seem to be working as expected. At the moment, there is no response upon hover and it remains non-responsive. I would greatly appreciate ...

5 Ways to Incorporate Font Awesome Icons into CSS Pseudo Elements

I'm attempting to incorporate FontAwesome icons into CSS pseudo elements. When I add the icon using HTML in the traditional manner, it works fine. However, I'm trying to integrate the fonts into a bootstrap accordion so that the icon changes whe ...

Body Zoom Browser

My website features buttons for zooming in and out, labeled as A + and A-. I wanted to make sure that the entire body of the website could be magnified easily. That's why I came up with this code: <html> <body> <style> .cont ...

Changing the color of a placeholder using Javascript: A step-by-step guide

I've been searching online without any luck so far. I'm attempting to change the placeholder color of a text box using JavaScript, but I'm not sure how to go about it. I already have a color picker that changes colors. If my CSS looks somet ...

"Troubangular: Troubleshooting unexpected behavior when trying to update ngFor after setting a property

Dealing with what seems like a straightforward component here. I'm fetching an array of objects from an API, storing them in a property, and then displaying them in a select list for the user to choose from. When the value changes, I filter the result ...

What is the process for creating two columns with an input box beneath them?

I am facing a challenge with my code. I am struggling to create the desired design where there are two columns and below them an input box that will be displayed when a button is pressed. The design I am aiming for can be viewed here: enter image descripti ...

Creating an XPATH Selector with SCRAPY

Having trouble retrieving the product name from a webpage: Struggling to locate XPATH that delivers a useful, specific result. Apologies for my initial question being quite basic :( class V12Spider(scrapy.Spider): name = 'v12' start_ur ...

Setting table row styles for odd and even rows, based on user clicks of an <input type="file"> button

I'm currently working on a feature that allows users to upload files to a page using an button. Each file is displayed in a table as a new row. I am looking for a way to set the background color differently for odd and even rows. As of now, I am usin ...

jQuery insert custom text into HTML and eliminate malfunctioning elements

Using jQuery, I have created a form where the entered text is appended to certain elements. This functionality works correctly. Additionally, I have included a remove link with each added element. When someone clicks on the remove button, it should remove ...

How can I invoke a TypeScript function within HTML code?

Currently, I am working on an Angular project where I have implemented two straightforward methods in a TypeScript file: findForm(text: string, forms: Array<string>) { for (let form of this.forms) { if (text.includes(form)) { retur ...

Creating a unique design by displaying text in a modern, diagonally split rectangle using HTML and CSS

To creatively display the diagonal of a fictional rectangle using HTML/CSS, along with text written both above and below it. The main objective is to create a heading for a unique table design in the top left corner. This will help describe the row header ...

Removing dropdown lists from input forms can be achieved without using jQuery by utilizing vanilla JavaScript

Looking to build a custom HTML/JavaScript terminal or shell. Interested in utilizing an input box and form to interact with JavaScript functions/commands. Unsure of how to eliminate the drop-down menu that appears after previous inputs. Pictured terminal: ...

``There seems to be an issue with the alignment of items in the

I am fairly new to using css and bootstrap and I am currently working on integrating a carousel into my angular web app. I copied the code from the bootstrap site but I am facing challenges in aligning everything properly. Additionally, the image slides do ...