Adjust the dimensions of the initial cell

I need to adjust the size of the initial "generated" cell in a grid. The grid is not present in the HTML markup until JavaScript prints RSS information on it, making it difficult to target specific rows or cells directly.

Note: The first element is hidden with display:none; because it repeats itself.

Desired outcome: https://i.sstatic.net/dJNHO.jpg

Current grid: https://codepen.io/jinzagon/pen/JjXMXxo

CSS

body {
  margin: 1rem;
  display: grid;
  background-color: #272d32;
  grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
  grid-gap: 2rem;
}
img {
  max-width: 100%;
  box-shadow: 0 0 3px #B0BEC5;
  width: 100%;
  object-fit: cover;
  display: block; 
}


article {
  background: #ECEFF1;
  border-radius: 4px;
  overflow: hidden;
  height: 250px;
  font: 12px/1.1 system-ui, sans-serif;
  a {
    text-decoration: none;
    color: #455A64;
    &:hover, &:focus {
      color: #2196F3;
    }
  }
  h2 {
    padding: 1rem 1rem;
    margin: 0;
  }
}

article:first-of-type {
  display: none;
}

JS

const RSS_URL = 'https://cors-anywhere.herokuapp.com/https://fitgirl-repacks.site/feed/';

fetch(RSS_URL)
  .then(response => response.text())
  .then(str => new window.DOMParser().parseFromString(str, "text/xml"))
  .then(data => {
    console.log(data);
    const items = data.querySelectorAll("item");
    let html = ``;
    items.forEach(el => {
      var image = null;
      var encoded = new window.DOMParser().parseFromString(
        el.getElementsByTagNameNS("*", "encoded").item(0).innerHTML,
        "text/html"
      );
      
      if (encoded.querySelector('img') !== null) {
        image = encoded.querySelector('img').src;
      } else {
        return true;
      }
      
      
      html += `
        <article>
            <!-- <h2>${el.querySelector("title ").innerHTML}</h2>
              <a  href="${el.querySelector("link").innerHTML}" target="_blank" rel="noopener">
                
              </a> -->
              <img src="${image}" alt="" />
        </article>
      `;
    });
    document.body.insertAdjacentHTML("beforeend", html);
  });

Answer №1

...so I am unable to directly select a row or cell.

Would using nth-of-type(2) work?

body {
  margin: 1rem;
  display: grid;
  background-color: #272d32;
  grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
  grid-gap: 2rem;
}

img {
  max-width: 100%;
  box-shadow: 0 0 3px #B0BEC5;
  width: 100%;
  /* height: 100%; */
  object-fit: cover;
  display: block;
}

article {
  background: #ECEFF1;
  border-radius: 4px;
  overflow: hidden;
  height: 250px;
  font: 12px/1.1 system-ui, sans-serif;
}

article a {
  text-decoration: none;
  color: #455A64;
}

article a:hover,
article a:focus {
  color: #2196F3;
}

article h2 {
  padding: 1rem 1rem;
  margin: 0;
}

article:first-of-type {
  display: none;
}

article:nth-of-type(2) {
  grid-column: 1 / 3;
  grid-row: 1 / 3;
  height: calc(500px + 2rem)
}
<article>
  <!--<h2>Upcoming repacks
          </h2>
            <a  href="https://fitgirl-repacks.site/upcoming-repacks-3/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0904/6f/390a35bb4af268efc406df7092e0566f.jpg" alt="">
</article>

<article>
  <!--<h2>WRC 9 FIA World Rally Championship – Deluxe Edition + 4 DLCs
          </h2>
            <a  href="https://fitgirl-repacks.site/wrc-9/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0904/6f/390a35bb4af268efc406df7092e0566f.jpg" alt="">
</article>

<article>
  <!--<h2>Desperados III – v1.4.11.r35885.F + DLC
          </h2>
            <a  href="https://fitgirl-repacks.site/desperados-3/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0611/b0/9d2d6cd9831af6219c231b80a66050b0.jpg" alt="">
</article>

<article>
  <!--<h2>Ary and the Secret of Seasons
          </h2>
            <a  href="https://fitgirl-repacks.site/ary-and-the-secret-of-seasons/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0902/48/2cf078dae0fcbff545c79346f80fcd48.jpg" alt="">
</article>

<article>
  <!--<h2>Crusader Kings III – v1.0.2 + 2 DLCs + Multiplayer
          </h2>
            <a  href="https://fitgirl-repacks.site/crusader-kings-3/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0902/43/eca1095d8782e7bdcd6f6ea5cfa45e43.jpg" alt="">
</article>

<article>
  <!--<h2>Iron Harvest – v1.0.0.1600 rev.37863 (Build 5487982)
          </h2>
            <a  href="https://fitgirl-repacks.site/iron-harvest/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0901/ca/3b9619cd2c253ec78d94abfc00415eca.jpg" alt="">
</article>

<article>
  <!--<h2>Evergate – v1.02/Build 5487187
          </h2>
            <a  href="https://fitgirl-repacks.site/evergate/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0901/e1/93dd0a0484b586c8df76480fe36ccce1.jpg" alt="">
</article>

<article>
  <!--<h2>Radical Relocation – v1.0.0P9 + All Levels Unlocker
          </h2>
            <a  href="https://fitgirl-repacks.site/radical-relocation/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0831/89/975d31cea79f6ac8c543219b05be0489.jpg" alt="">
</article>

<article>
  <!--<h2>Immortal Realms: Vampire Wars
          </h2>
            <a  href="https://fitgirl-repacks.site/immortal-realms-vampire-wars/" target="_blank" rel="noopener">
             
            </a>-->
  <img src="https://i112.fastpic.ru/big/2020/0831/ec/9e7ee3ca4c50ca7b1ebdd48647fba4ec.jpg" alt="">
</article>
</body>

Answer №2

Consider including the grid-column and grid-row properties for the first instance of article, adjusting the span value to your preferences: Check out this example on CodePen!

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 current situation is not effective; it is causing an error saying "Uncaught TypeError: Cannot read property 'substring' of undefined"

Encountering an error "Uncaught TypeError: Cannot read property 'substring' of undefined" while debugging in Chrome Inspector, with the following code: <script type="text/javascript"> $(function countComments() { var mcount = '/ ...

Organizing pictures by category

I am currently working on creating an interactive image gallery with sorting options based on different categories such as land, sea, animals, and more. I have created a small example to demonstrate my concept. My objective: is to allow users to select a ...

The placement of the sliding navigation menu is consistently positioned beneath the header

I created a jQuery menu that's also available on JSfiddle here: $(document).ready(function () { $(".navigation_button").on('click', function () { var $panel = $(this).next('.panel'); if ($panel.is(':visible ...

How to style text alignment and create a toggle button using HTML and CSS

My attempt at creating a custom toggle button using an HTML input checkbox and custom CSS has resulted in a misalignment between the text and the toggle button itself. Despite my efforts to adjust margins, padding, and heights, I have been unable to resolv ...

Guide to utilizing a JavaScript variable within a jQuery GET request using 'data:'

After putting in a lot of effort, I finally managed to make my jquery form work smoothly. The responses are coming back exactly how I want them to. However, there's one issue - I'm currently using static test data to send to the jquery function. ...

The white background of the .jpg image is conflicting with the white background of the HTML

My website has a top-of-page .jpg image that was created with a white background. However, when using the img src="topOfEveryPageImage.jpg" tag, the white background of the image appears visually different from the rest of the solid white background on the ...

Enhance mix-blend mode or filtering effects in SCSS using an SVG component in VueJS

I am currently developing a fixed navbar at the top of a webpage with several SVGs inside anchor tags. I want the SVGs to appear black when displayed over lighter colored divs (other Vue components) and white when displayed over darker colored ones. The ba ...

Dynamically insert the ng-if attribute into a directive

In my code, I have implemented a directive that adds an attribute to HTML elements: module1.directive('rhVisibleFor', function ($rootScope) { return{ priority: 10000, restrict: 'A', compi ...

Create a series of vertical lines using jQuery

I'm dealing with a JSON data set that I want to use to generate a grid. In addition to the grid, I also need to display vertical lines above it based on certain values: var arr = []; arr= [ {"Measure":"Air Pollution","Rank":"1","Value":"15.5"}, ...

What is preventing me from applying styles to the first word in my Angular ngFor iteration?

I'm currently attempting to customize the initial word of a string within my Angular ngFor loop. Strangely, the class gets applied but the style defined in my CSS file is not. Inline styling also does not seem to work - any ideas why? This is the CSS ...

Maximizing the efficiency of a personalized hook that facilitates data sharing in React

I have developed a unique Custom Hook that looks like the following: import { useEffect, useState } from 'react'; import axios from 'axios'; const myCustomHook = () => { const [countries, setCountries] = useState([]); const [i ...

Next.js has a problem where it displays incorrect data when users navigate rapidly between pages

An unusual challenge has emerged while rendering data on a Next.js page in my application. Here's the scenario: I've created a Next.js page that showcases customer details based on a query parameter called cid. The page retrieves customer data an ...

The markers within a loop in react-native-maps are failing to render

Recently, I've been delving into the world of React Native app development for iOS. Specifically, I've been experimenting with the react-native-maps package. Here's the issue I'm facing: When I statically render a single MapView.Marker, ...

Create a default function within a mongoose field

Is there a way to achieve the following in my code: var categorySchema = new Schema({ id: { unique: true, default: function() { //set the last item inserted id + 1 as the current value. } }, name: String }); Can this be done? ...

What is the method for conducting an Ajax request?

Currently, I am deeply involved in a personal project to enhance my skills with Rails. The project involves developing a task management application that encompasses three primary states: todo, in progress, and done. After numerous days of trial and error, ...

Retrieve information from the Action controller to communicate with Jquery via an HttpPost or Get request

I am trying to retrieve the result of a calculation in my action controller by calling the action using an AJAX HTTP POST request. I want to capture the value of the calculation and display it in a div element. However, I am unsure whether I should use HTT ...

Python Mechanize file uploading capabilities

Hey there! I've been experimenting with mechanize and Python to upload a file to a website. I've had some success so far, but now I'm facing a challenge at the upload page. I understand that mechanize doesn't support JavaScript, but I&a ...

Error message: Angular JS encountered an issue when trying to initiate the test module. The cause

When I run JavaScript within an HTML file and use AngularJS with ng-repeat function, I encounter this console error: angular.js:38 Uncaught Error: [$injector:modulerr] Clicking on the link in the error message leads to: Failed to instantiate module test ...

"Enhance your PHP-MySQL data tables by implementing the Datatable Server Processing script using ssp.class.php

My goal is to build a data grid using the Datatables jQuery plugin and handle server-side processing with the provided ssp.class.php. While it initially worked, I encountered an issue when trying to retrieve data from multiple tables. To solve this, I util ...

Troubleshooting: Angular Custom Elements malfunction on Firefox, Microsoft Edge, and Internet Explorer

Experimented with the Angular Elements Demo After downloading, installing, and building the demo locally. Implemented the following code: <!doctype html> <html lang="en> <head> <meta charset="utf-8> <title>Angular Eleme ...