CSS Grid - Customizing grid layouts

Can someone please explain why my CSS grid layout is not working as expected? I defined a grid-template-area for a 4x3 grid with equal sections, but it's not displaying correctly. I have provided a fiddle to demonstrate the issue along with the code snippet below. Any insights on what went wrong would be greatly appreciated. Fiddle

.container {
    display: grid;
    width: 100%;
    height: 100%;
    grid-template-areas: "a b c d"
                         "b c d a"
                         "a b c d";
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.container > header {
    grid-area: a;
}

.container > nav {
    grid-area: b;
}

.container > main {
    grid-area: c;
}

.container > footer {
    grid-area: d;
}

<div class="container">
    <header><h1>A</h1></header>
    <nav><h1>B</h1></nav>
    <main><h1>C</h1></main>
    <footer><h1>D</h1></footer>
</div>

Answer №1

Switching things up, the new sequence in row two reads "b v d a" rather than the expected "a b c d".

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

Donut chart in SVG format failing to display properly in email messages

Here is an example of a donut chart that I am working with: <div class="donut-chart" style="position: relative;"> <svg width="100%" height="100%" viewBox="0 0 42 42" class="donut"> ...

Convert JSON objects within an array into HTML format

Is there a way to reformat an array of JSON objects that has the following structure? [{"amount":3,"name":"Coca-Cola"},{"amount":3,"name":"Rib Eye"}] The desired output in plain HTML text would be: 3 - Coca-Cola 3 - Rib Eye What is the best approach to ...

The margin-bottom attribute for the final element within a div does not cause the div to be "stretched."

Having a div with a background image containing an element with margin-bottom applied can cause a gap between that div and another one below it, also with a background image. This leads to the issue illustrated in this screenshot: Screenshot http://img40.i ...

Reorganizing the layout of grid items

Currently, I am working on a task involving GRID CSS. The main objective of the task is to utilize GRID specifically, rather than other methods like flex. I have successfully set up two columns in my GRID, each with its own divs. However, what I am struggl ...

Guide on setting the HTML img src value with AR.ImageResource in ARchitectBrowser.html while utilizing the Wikitude SDK for iOS

I am currently customizing the ARchitectBrowser.html file provided by the Wikitude SDK for iOS and I am interested in finding a way to directly insert an image set in AR.ImageResource. bubbleImage = new AR.ImageResource("http://graph.facebook.com/" + json ...

Extract JSON data from Python API

Currently, I am delving into web programming and have created a Python API that queries an SQL database to return a JSON. The functionality of the API is as expected. In parallel, I've developed a controller where I execute a GET request to utilize t ...

Making sure all items in the top row of Flexbox columns have the same height

Within my flex wrapper, I have multiple column components with various flex items inside. Each column displays content adjacent to each other. The challenge is to ensure that the top item in each column has an equal height, creating a row-like effect. I&a ...

Click-triggered CSS animations

Trying to achieve an effect with regular JS (not jQuery) by making images shake after they are clicked, but running into issues. HTML: <img id='s1_imgB' class="fragment"... onClick="wrongAnswer()"... JS: function wrongAnswer(){ docume ...

Achieving Vertical Content Alignment in Bootstrap 4

I am struggling to achieve a responsive design where two columns stack vertically on top of each other when viewed on smaller mobile screens. Despite numerous attempts, I have been unable to figure it out. Ideally, I want the layout to look like this imag ...

Using customized CSS code may not always be compatible with Bootstrap 5

One scenario I encountered was my attempt to change the background color of the body using style.css, but unfortunately, the code wasn't effective. Below is my reference to Bootstrap 5 and custom CSS: <link href="https://cdn.jsdelivr.net/npm/& ...

Show or conceal input fields depending on the selection of radio buttons

Hello everyone, I am new to JavaScript and currently learning. Can someone please assist me in fixing this code? The required inputs are: radio-button-1; radio-button-2; input-fields-set-1; input-fields-set-2; input-field-submit. My objective is: Upon ...

Transfer the information of a selected element to a different element

Hello, I am trying to transfer content from a child element to another element. In my HTML setup, there is a hidden div named "DetailsExpanded" and multiple items called "IconWrapper". When an "IconWrapper" is clicked, I want to copy the content of its "I ...

Interactive website featuring 3DSMax .obj and .max models with advanced AJAX clickable functionalities

I have a 3DSMax model in both .obj and .max file formats. This model includes clickable points that work perfectly within 3DSMax, displaying details when clicked. My goal is to showcase this interactive model on the web with all its clickable features int ...

Looking to update a component in Vue 3 and Laravel 9 without the need to reload the entire webpage

Looking for a solution to refresh the header component upon clicking the logout button, in order to display the login and register options without refreshing the entire page. Any effective suggestions on how to achieve this are greatly appreciated. The l ...

"Want to make a phone call with an extension? Just click here

The issue at hand is rather straightforward. Is there a way to create a link for mobile browsers that would automatically dial a phone number and input an extension without requiring any action from the user? I am familiar with using tel:, as well as spe ...

Refresh an iframe using Javascript

Hey there, I could really use some assistance with this code. It works perfectly for reloading an iframe using an id, but I'm struggling to figure out how to make it work with a class so that I can reload multiple iframes. Alternatively, I'd like ...

Fill the list items with values from the given array

I have an array called var array = ["one", "two"]; and I want to display each element in a separate list item. The desired output is: <li>Number one</li> <li>Number two</li> However, the current output is: <li>Number onetw ...

Understanding the significance of the asterisk symbol in CSS

Is This CSS Syntax Correct? css: the meaning of * mark What is the function of * in CSS? I came across some code here that included it: .center-wrapper{ text-align: center; } .center-wrapper * { margin: 0 auto; } Could this be a mistake? ...

The challenge of applying flex property in React Native JSX

I'm facing a challenge while trying to implement form field validation in various forms within a React Native mobile application. The problem arises when the error message, which should appear below the text input field, ends up occupying half of the ...

The search results in ajax live search are present, but unfortunately they are not displaying on

I am currently working on a code for an ajax live search feature and need some help with getting results to display $(document).ready(function() { $("#search").keyup(function() { var query = $(this).val(); if (query != "" && query.leng ...