For the question you asked why button jumps to a new line after a element?
That is because div by default is a block element (display:block) which means it starts on a new line and takes the whole width and hence the button next to it is displayed on the next line. To change this behavior, use css to change display property of the div to inline element.