Skip to content Skip to sidebar Skip to footer

How To Offset A Grid Item, Also Shifting Its Siblings?

I am using CSS Grids. I want to offset an element so that it horizontally moves across the grid columns. I also want this element to retain its current width, and apply the offset

Solution 1:

I'm not 100% sure what you want to achieve, but maybe this will help:

.container {
  display: grid;
  grid-template-columns: repeat(4, 100px);
  padding-left: 100px;
}

.item {
  grid-column: span 1;
  background-color: orange;
  border: black solid 1px;
  height: auto;
  padding: 20px;
  text-align: center;
}
<divclass="container"><divclass="item offset">1/4</div><divclass="item">1/4</div><divclass="item">1/4</div></div>

Post a Comment for "How To Offset A Grid Item, Also Shifting Its Siblings?"