Unfortunately absolute positioning removes the element from the flow so any other elements will not react to it. The solution would most likely be with no positioning at all but flexbox or grid to layout all the items properly.
Sorry, I can’t give an example but I don’t know the rest of your page and I don’t want to send you on a wild goose chase with the wring code