Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Why css-grid doesn't work correctly in dynamically changing lauout using Jquery? Reply To: Why css-grid doesn't work correctly in dynamically changing lauout using Jquery?

#268230
Paulie_D
Member

You’d defined certain children as having grid positions but those weren’t being updated by the JQuery.

The same goes for some of the divs…which apply in multiple cases.

.main div:nth-child(3) {
  background: blue;
  height:100%;
}

for instance.

So if you make the selector more specific

.main > div:nth-child(2) { 
  background: green;
  display: grid;
  grid-gap: 0.4rem;
}

https://codepen.io/Paulie-D/pen/oqbWaN