0

I would like to make an inventory system for FiveM, but I can't really seem to figure out how to set the maximum amount of elements in a row, inside a container. I tried using the max-width property, but that just leaves space awkward space on the right side here's a screenshot. SS without, anything: https://prnt.sc/1qtqfj1 SS with max-width: https://prnt.sc/1qtqsd7

#container {
  display: flex;
  position: relative;
  width: max-content;
  max-width: 1000px;
  padding-top: 25px;
  padding-bottom: 25px;
  padding-left: 15px;
  padding-right: 15px;
  height: 550px;
  background-color: rgba(25, 25, 25, 1.0);
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
  border-radius: 15px;
  overflow: hidden;
  user-select: none;
  box-shadow: 0px 5px 10px rgb(0 0 0 / 80%);
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: flex-start;
}

#slot-1 {
  position: relative;
  margin-bottom: 5px;
  margin-right: 5px;
  margin-left: 5px;
  background-color: rgba(0, 0, 0, 1.0);
  width: 100px;
  height: 100px;
  border-radius: 15px;
}
<div id="container">
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
  <div id="slot-1"></div>
</div>

I'm currently using HTML and CSS only but will convert some stuff to Javascript, just need some testing first.

I would need a fixed number of divs in one row, and also dynamic padding, etc...

Any help would be appreciated.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
lathlaszlo
  • 11
  • 2

0 Answers0