 /* limit width so that content will need to scroll */
main {
  max-width: 50em;
}

/* SCROLL SNAPPING */
.scroll-container {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.scroll-item {
  scroll-snap-align: center;
}
/* make 3rd item bigger to show that items don't need to have the same width */
.scroll-item:nth-child(10) {
  width: 15em;
}
/* make 5th item bigger to show that items don't need to have the same width */
.scroll-item:nth-child(5) {
  height: 15em;
}

/* FLEXBOX LAYOUT */
.scroll-container[data-layoutmethod="flexbox"] {
  display: flex;
  flex-wrap: nowrap;
  align-items: center; /* vertically align children */
}
.scroll-container[data-layoutmethod="flexbox"] .scroll-item {
  margin-right: 1em; /* fake gap */
  flex: 0 0 auto;
}

/* GRID LAYOUT */
.scroll-container[data-layoutmethod="grid"] {
  display: grid;
  grid: auto / auto-flow max-content;
  grid-gap: 1em;
  align-items: center; /* vertically align children */
}

/** OTHER STYLES **/
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  text-rendering: optimizeLegibility;
  margin: 0;
  padding: 0;
}

/* center main element */
main {
  margin: 0 auto;
  padding: 0 1em;
 
}

/* remove list styles */
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.scroll-item {
  /* make it square */
  width: 20em;
  height: 10em;
 

  /* some basic styling */
  
  border-radius: 0.2em;

  /* center contents */
  display: flex;
  justify-content: center;
  align-items: center;
}